Jarves\Admin\ObjectCrud::getBranchItems PHP Метод

getBranchItems() публичный Метод

Returns items per branch.
public getBranchItems ( mixed $pk = null, array $filter = null, mixed $fields = null, mixed $scope = null, integer $depth = 1, integer $limit = null, integer $offset = null, boolean $withAcl = false ) : mixed
$pk mixed
$filter array
$fields mixed
$scope mixed
$depth integer
$limit integer
$offset integer
$withAcl boolean
Результат mixed
    public function getBranchItems($pk = null, $filter = null, $fields = null, $scope = null, $depth = 1, $limit = null, $offset = null, $withAcl = false)
    {
        $storageController = $this->objects->getStorageController($this->getObject());
        if (null !== $pk) {
            $pk = $storageController->normalizePrimaryKey($pk);
        }
        if (null === $pk && $this->getObjectDefinition()->getNestedRootAsObject() && $scope === null) {
            throw new \Exception('No scope defined.');
        }
        $options = array();
        $options['offset'] = $offset;
        $options['limit'] = $limit ? $limit : $this->defaultLimit;
        $options['fields'] = $this->getBranchItemsSelection($fields);
        //
        //        if (!$fields) {
        //            $fields = array();
        //            $fields[] = $this->getObjectDefinition()->getLabelField();
        //
        //            if ($rootField = $this->getObjectDefinition()->getNestedRootObjectLabelField()) {
        //                $fields[] = $rootField;
        //            }
        //
        //            if ($extraFields = $this->getObjectDefinition()->getNestedRootObjectExtraFields()) {
        //                $extraFields = explode(',', trim(str_replace(' ', '', $extraFields)));
        //                foreach ($extraFields as $field) {
        //                    $fields[] = $field;
        //                }
        //            }
        //            $options['fields'] = implode(',', $fields);
        //        }
        //        if ($filter) {
        //            $conditionObject = $filter instanceof Condition ? $filter : self::buildFilter($filter);
        //        } else {
        $conditionObject = $this->getCondition();
        //        }
        if ($limit = $this->getObjectDefinition()->getLimitDataSets()) {
            $conditionObject->mergeAnd($limit);
        }
        if ($extraCondition = $this->getCustomListingCondition()) {
            $conditionObject->mergeAnd($extraCondition);
        }
        if ($this->getPermissionCheck() && ($aclCondition = $this->acl->getListingCondition($this->getObject()))) {
            $conditionObject->mergeAndBegin($aclCondition);
        }
        $options['order'] = $this->getOrder();
        $items = $storageController->getBranch($pk, $conditionObject, $depth, $scope, $options);
        if ($withAcl && is_array($items)) {
            foreach ($items as &$item) {
                $this->prepareRow($item);
            }
        }
        return $items;
    }
ObjectCrud