protected function _getConditionsForEmployeeTreeInfo($id = null, $includeRoot = true, $includeBlocked = false) {
		$result = [];
		if (!$includeBlocked && $this->Employee->hasField('block')) {
			$result[$this->Employee->alias . '.block'] = false;
		}
		if (empty($id)) {
			return $result;
		}

		$conditions = [
			$this->alias . '.id' => $id
		];
		$fields = [
			$this->alias . '.parent_id',
			$this->alias . '.lft',
			$this->alias . '.rght',
		];
		$this->recursive = -1;
		$subordinateTreeInfo = $this->find('first', compact('conditions', 'fields'));
		if (empty($subordinateTreeInfo)) {
			return false;
		}

		$conditionItem = '';
		if ($includeRoot) {
			$conditionItem = '=';
		}
		$result[$this->alias . '.lft >' . $conditionItem] = $subordinateTreeInfo[$this->alias]['lft'];
		$result[$this->alias . '.rght <' . $conditionItem] = $subordinateTreeInfo[$this->alias]['rght'];

		return $result;
	}
protected function _getConditionsForEmployeeTreeInfo($id = null, $includeRoot = true, $includeBlocked = false) {
		$result = [];
		if (!$includeBlocked && $this->Employee->hasField('block')) {
			$result[$this->Employee->alias . '.block'] = false;
		}
		if (empty($id)) {
			return $result;
		}

		$conditions = [
			$this->alias . '.id' => $id
		];
		$fields = [
			$this->alias . '.parent_id',
			$this->alias . '.lft',
			$this->alias . '.rght',
		];
		$this->recursive = -1;
		$subordinateTreeInfo = $this->find('first', compact('conditions', 'fields'));
		if (empty($subordinateTreeInfo)) {
			return false;
		}

		$conditionItem = '';
		if ($includeRoot) {
			$conditionItem = '=';
		}
		$result[$this->alias . '.lft >' . $conditionItem] = $subordinateTreeInfo[$this->alias]['lft'];
		$result[$this->alias . '.rght <' . $conditionItem] = $subordinateTreeInfo[$this->alias]['rght'];

		return $result;
	}
protected function _getConditionsForEmployeeTreeInfo ( $ id = null , $ includeRoot = true , $ includeBlocked = false ) { $ result = [ ] ; if ( ! $ includeBlocked && $ this -> Employee -> hasField ( 'block' ) ) { $ result [ $ this -> Employee -> alias . '.block' ] = false ; } if ( empty ( $ id ) ) { return $ result ; } $ conditions = [ $ this -> alias . '.id' => $ id ] ; $ fields = [ $ this -> alias . '.parent_id' , $ this -> alias . '.lft' , $ this -> alias . '.rght' , ] ; $ this -> recursive = - 1 ; $ subordinateTreeInfo = $ this -> find ( 'first' , compact ( 'conditions' , 'fields' ) ) ; if ( empty ( $ subordinateTreeInfo ) ) { return false ; } $ conditionItem = '' ; if ( $ includeRoot ) { $ conditionItem = '=' ; } $ result [ $ this -> alias . '.lft >' . $ conditionItem ] = $ subordinateTreeInfo [ $ this -> alias ] [ 'lft' ] ; $ result [ $ this -> alias . '.rght <' . $ conditionItem ] = $ subordinateTreeInfo [ $ this -> alias ] [ 'rght' ] ; return $ result ; }
Return condition for build tree of subordinate employees

@param int|string $id ID of record as root element
@param bool $includeRoot If True, include root element in result
@param bool $includeBlocked If False, include only non-blocked employees.
@return array Return array condition for build tree of subordinate employees,
use Model::find().
Return condition for build tree of subordinate employees