protected function _getSubTree(Model $model, $id = null) {
		$result = [];
		$parentField = $this->_getBehaviorConfig($model, 'parent');
		$leftField = $this->_getBehaviorConfig($model, 'left');
		if (($parentField === null) || ($leftField === null)) {
			return $result;
		}

		$conditions = [
			$model->alias . '.' . $parentField => null
		];
		if (!empty($id)) {
			$conditions[$model->alias . '.' . $parentField] = (int)$id;
		}
		if ($model->Behaviors->Tree->settings[$model->alias]['scope'] !== '1 = 1') {
			$conditions[] = $model->Behaviors->Tree->settings[$model->alias]['scope'];
		}

		$fields = [
			$model->alias . '.' . $model->primaryKey,
		];
		$order = [
			$model->alias . '.' . $leftField => 'asc'
		];
		$model->recursive = -1;
		$data = $model->find('list', compact('conditions', 'fields', 'order'));
		if (!empty($data)) {
			$result = array_keys($data);
		}

		return $result;
	}
protected function _getSubTree(Model $model, $id = null) {
		$result = [];
		$parentField = $this->_getBehaviorConfig($model, 'parent');
		$leftField = $this->_getBehaviorConfig($model, 'left');
		if (($parentField === null) || ($leftField === null)) {
			return $result;
		}

		$conditions = [
			$model->alias . '.' . $parentField => null
		];
		if (!empty($id)) {
			$conditions[$model->alias . '.' . $parentField] = (int)$id;
		}
		if ($model->Behaviors->Tree->settings[$model->alias]['scope'] !== '1 = 1') {
			$conditions[] = $model->Behaviors->Tree->settings[$model->alias]['scope'];
		}

		$fields = [
			$model->alias . '.' . $model->primaryKey,
		];
		$order = [
			$model->alias . '.' . $leftField => 'asc'
		];
		$model->recursive = -1;
		$data = $model->find('list', compact('conditions', 'fields', 'order'));
		if (!empty($data)) {
			$result = array_keys($data);
		}

		return $result;
	}
protected function _getSubTree ( Model $ model , $ id = null ) { $ result = [ ] ; $ parentField = $ this -> _getBehaviorConfig ( $ model , 'parent' ) ; $ leftField = $ this -> _getBehaviorConfig ( $ model , 'left' ) ; if ( ( $ parentField === null ) || ( $ leftField === null ) ) { return $ result ; } $ conditions = [ $ model -> alias . '.' . $ parentField => null ] ; if ( ! empty ( $ id ) ) { $ conditions [ $ model -> alias . '.' . $ parentField ] = ( int ) $ id ; } if ( $ model -> Behaviors -> Tree -> settings [ $ model -> alias ] [ 'scope' ] !== '1 = 1' ) { $ conditions [ ] = $ model -> Behaviors -> Tree -> settings [ $ model -> alias ] [ 'scope' ] ; } $ fields = [ $ model -> alias . '.' . $ model -> primaryKey , ] ; $ order = [ $ model -> alias . '.' . $ leftField => 'asc' ] ; $ model -> recursive = - 1 ; $ data = $ model -> find ( 'list' , compact ( 'conditions' , 'fields' , 'order' ) ) ; if ( ! empty ( $ data ) ) { $ result = array_keys ( $ data ) ; } return $ result ; }
Return list ID of subtree for item.

@param Model $model Model using this behavior.
@param int|string $id The ID of the item to get a list ID of subtree.
@return array Return list of ID.
Return list ID of subtree for item .