Jarves\Objects::getList PHP Метод

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

$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
Результат array | boolean
    public function getList($objectKey, $filter = null, $options = array())
    {
        $repository = $this->getRepository($objectKey, $options);
        return $repository->getItems($filter, null, null, null, @$options['fields']);
    }

Usage Example

Пример #1
0
 /**
  * @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);
 }
All Usage Examples Of Jarves\Objects::getList