getList() public method

$options is a array which can contain following options. All options are optional. 'fields' Limit the columns selection. Use a array or a comma separated list (like in SQL SELECT) If empty all columns will be selected. 'offset' Offset of the result set (in SQL OFFSET) 'limit' Limits the result set (in SQL LIMIT) 'order' The column to order. Example: array( array('category' => 'asc'), array(title' => 'asc') ) 'permissionCheck' Defines whether we check against the ACL or not. true or false. default false
public getList ( string $objectKey, array $filter = null, array $options = [] ) : array | boolean
$objectKey string
$filter array
$options array
return array | boolean
コード例 #1
0
ファイル: AclController.php プロジェクト: jarves/jarves
 /**
  * @ApiDoc(
  *  section="ACL Management",
  *  description="Search user and group"
  * )
  *
  * @Rest\QueryParam(name="q", requirements=".*", description="Search query")
  *
  * @Rest\Get("/user/acl/search")
  *
  * @param string $q
  *
  * @return array array('users' => array, 'groups' => array())
  */
 public function getSearch($q)
 {
     $q = str_replace("*", "%", $q);
     $userFilter = array();
     $groupFilter = array();
     if ($q) {
         $userFilter = array(array('username', 'like', "{$q}%"), 'OR', array('first_name', 'like', "{$q}%"), 'OR', array('last_name', 'like', "{$q}%"), 'OR', array('email', 'like', "{$q}%"));
         $groupFilter = array(array('name', 'like', "{$q}%"));
     }
     $users = $this->objects->getList('jarves/user', $userFilter, array('limit' => 10, 'fields' => 'id,username,email,groups.name,firstName,lastName'));
     $this->setAclCount($users, 0);
     $groups = $this->objects->getList('jarves/group', $groupFilter, array('fields' => 'name', 'limit' => 10));
     $this->setAclCount($groups, 1);
     return array('users' => $users, 'groups' => $groups);
 }
コード例 #2
0
ファイル: ObjectCrud.php プロジェクト: jarves/jarves
 public function getRoots($condition = null, $lang = null, $domain = 0)
 {
     $storageController = $this->objects->getStorageController($this->getObject());
     if (!$this->getObjectDefinition()->isNested()) {
         throw new \Exception('Object is not a nested set.');
     }
     $options['fields'] = $this->getNestedSelection($this->getObjectDefinition()->getNestedRootObjectLabelField());
     if ($this->getObjectDefinition()->getNestedRootAsObject()) {
         $rootObjectKey = Objects::normalizeObjectKey($this->getObjectDefinition()->getNestedRootObject());
         $filter = [];
         if ($domain) {
             if ('jarves/domain' === $rootObjectKey) {
                 $filter['id'] = $domain;
             } else {
                 $filter['domain'] = $domain;
             }
         }
         if ($lang) {
             $filter['lang'] = $lang;
         }
         //            $rootCondition = new Condition();
         //            $rootCondition->addAnd(['id', '=', $domain]);
         return $this->objects->getList($rootObjectKey, $filter, $options);
     } else {
         //            $conditionObject = $condition ?: new Condition(null, $this->jarves);
         //
         //            if ($this->getPermissionCheck() && $aclCondition = $this->acl->getListingCondition($this->getObject())) {
         //                $conditionObject->mergeAndBegin($aclCondition);
         //            }
         return $storageController->getRoots(null, $options);
     }
 }