Serves the index of all entity

@param array $filters
@param array $orderBy
@param array $groupBy
@return EntityInterface
326120
public function index(
        array $filters = [],
        $orderBy = [],
        $groupBy = []
    ) {
        $selection = $this->provider->selectAll($filters, $orderBy, $groupBy);
        $query = $this->provider->query($selection);
        return $query->getResult();
    }
272908
private function _prepareGroupBy(array $groupByArray)
	{
		if(count($groupByArray) === 1)
		{
			foreach($groupByArray as $orderMode => $column)
			{
				/** @var ColumnInterface $column */
				$this->groupBy = 'GROUP BY ' . $column->getColumnName() . ' ';
				if(is_string($orderMode))
				{
					$this->groupBy .= $orderMode . ' ';
				}
			}
		}
	}
907249
public function getRecords($filter = '', $order = ['.id'], $page = 1, $count = null, $dataDimensions = null)
    {

        if ($dataDimensions == null) {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        $caching = false;

        if ($this->isContentQueryRecordsCaching() && ($filter != '' || $count != null)) {
            $caching = true;
        }
        if ($this->isAllContentRecordsCaching() && ($filter == null && $count == null)) {
            $caching = true;
        }

        if ($caching) {

            if (!is_array($order)) {
                $order = [$order];
            }

            $cacheKey = $this->createCacheKey('records-query',
                                              [$this->getCurrentContentTypeName(), $filter, $page, $count, join(',', $order)], $dataDimensions);

            $data = $this->getCacheProvider()->fetch($cacheKey);
            if ($data) {
                $data = json_decode($data, true);

                $recordFactory = $this->getRecordFactory();
                $records       = $recordFactory->createRecordsFromJSONRecordsArray($this->getCurrentContentTypeDefinition(),
                                                                                   $data);

                foreach ($records as $record) {
                    $record->setRepository($this);
                    $record->setLanguage($dataDimensions->getLanguage());
                    $record->setWorkspace($dataDimensions->getWorkspace());
                    $record->setViewName($dataDimensions->getViewName());
                }

                return $records;
            }

            $records = parent::getRecords($filter, $order, $page, $count, $dataDimensions);

            $data = json_encode($records);

            $this->getCacheProvider()->save($cacheKey, $data, $this->contentQueryRecordsCaching);

            return $records;
        }

        return parent::getRecords($filter, $order, $page, $count, $dataDimensions);
    }
179916
public function findOneBy(array $criteria, array $orderBy = [])
    {
        $persister = $this->em->getUnitOfWork()->getEntityPersister($this->entityName);

        return $persister->load($criteria, null, null, [], null, 1, $orderBy);
    }
992700
final public static function where(array $criteria, array $orderBy = ['createdAt' => 'DESC'], int $limit = null, int $offset = null, bool $withTrash = false)
    {
        $criteria = self::criteriaWithSoftDelete($criteria, $withTrash);
        return static::getRepository()
            ->findBy($criteria, $orderBy, $limit, $offset);
    }
179812
public function get($filters = [], $sorts = [], $fields = [], $embeds = [])
	{
		$query = $this->model;

		foreach($filters as $filter)
		{
			if($filter['or'])
			{
				$query = $query->orWhere($filter['field'], $filter['operator'], $filter['value']);
			}
			else
			{
				$query = $query->where($filter['field'], $filter['operator'], $filter['value']);
			}
		}

		foreach($embeds as $embed)
		{
			$this->eagerLoad($embed);
		}

		foreach($sorts as $key => $sort)
		{
			$query = $query->orderBy($sort['field'], $sort['direction']);
		}

		// @todo: implement fields

		$retrieved = $this->retrieve($query);

		if($retrieved->isEmpty())
		{
			return new Payload($retrieved, 'not_found');
		}

		return new Payload($retrieved, 'found');
	}
595640
public function filterBy(array $criteria, array $orderBy = null, $limit = null, $offset = null, CompositeExpression $externalExpression = null)
    {
        $qb = $this->repository->createQueryBuilder('user')->distinct(true)
            ->leftJoin('user.contact', 'contact')
            ->leftJoin('contact.addresses', 'address')
            ->andWhere('address.type = :addressType')
            ->setParameter('addressType', 'main');

        if (array_key_exists('search', $criteria)) {
            $qb->andWhere('user.username like :searchLike or address.firstName like :searchLike or address.lastName like :searchLike or user.id=:search');
            $qb->setParameter('search', $criteria['search']);
            $qb->setParameter('searchLike', '%'.$criteria['search'].'%');
        }

        if (is_array($orderBy)) {
            foreach ($orderBy as $key => $value) {
                if ($key === 'id') {
                    $key = 'user.id';
                }
                $qb->orderBy($key, $value);
            }
        }

        $query = $qb->getQuery();
        $arrayResult = $query->getResult();
        $count = count($arrayResult);

        if ($offset === null) {
            $offset = 0;
        }

        if ($offset || $limit) {
            $arrayResult = array_slice($arrayResult, $offset, $limit);
        }

        $result = new FilterResult($arrayResult);
        $result->setCount($count);

        return $result;
    }
509144
final public function orderBy(string $orderBy, string $order = 'ASC')
    {        
       $this->query->addOrderBy($orderBy, $order);

        return $this;
    }
971796
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $this->preFindBy($criteria);

        $result =  $this->doFindBy($criteria, $orderBy, $limit, $offset);
        $result = $this->postFindBy($result);

        return $result;
    }
791180
public function findAll($executeQuery = true, $orderedBy = 'id', $order = null)
    {
        if (!$executeQuery) {
            $dql = "
                SELECT u, pws, g, r, rws
                FROM Claroline\CoreBundle\Entity\User u
                LEFT JOIN u.personalWorkspace pws
                LEFT JOIN u.groups g
                LEFT JOIN u.roles r
                LEFT JOIN r.workspace rws
                WHERE u.isRemoved = false
                ORDER BY u.{$orderedBy} {$order}
            ";

            return $this->_em->createQuery($dql);
        }

        return parent::findAll();
    }
848750
public function getOrderByIdentifier($orderBy)
    {
        $objectManager = $this->getObjectManager();
        $classMetadata = $objectManager->getClassMetadata($this->getEntityClass());

        if (strpos($orderBy, '::') === false) {

            if (!$classMetadata->hasField($orderBy)) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid order by column: Entity "%s" has no field "%s"',
                    $this->getEntityClass(),
                    $orderBy
                ));
            }

            $orderByIdentifier = $this->getEntityClassAlias()
                               . '.'
                               . $orderBy;
        } else {
            list($association, $assocProperty) = explode('::', $orderBy);

            if (!$classMetadata->hasAssociation($association)) {
                throw new \InvalidArgumentException(sprintf(
                    'Invalid order by column: Entity "%s" has no association "%s"',
                    $this->getEntityClass(),
                    $association
                ));
            }

            if (in_array($assocProperty, array('count'))) {
                //@FIXME
                $orderByIdentifier = $this->getEntityClassAlias()
                                   . '.id';

            } else {
                $assocTargetClass = $classMetadata->getAssociationTargetClass($association);

                if (!$objectManager->getClassMetadata($assocTargetClass)->hasField($assocProperty)) {
                    throw new \InvalidArgumentException(sprintf(
                        'Invalid order by column: Entity "%s" has no field "%s"',
                        $assocTargetClass,
                        $assocProperty
                    ));
                }

                $joinAlias         = self::JOIN_ALIAS_PREFIX . $association;
                $orderByIdentifier = $joinAlias . '.' . $assocProperty;
            }
        }

        return $orderByIdentifier;
    }
313370
public function orderBy($orderBy = null) {
		if (is_array($orderBy))
			$this->orderByClause = $orderBy;
		else
			$this->orderByClause = func_get_args();
		return $this;
	}
121293
public function addOrder(array $orderBy, $entityAlias = null)
    {
        foreach ($orderBy as $field => $order) {
            if (preg_match('/^[a-z0-9][a-z0-9\_]+$/i', $field)) {
                $this->addOrderBy(($entityAlias?$entityAlias.'.':'').$field, $order);
            } else {
                $this->addOrderBy($field, $order);
            }
        }

        return $this;
    }
1362978
public function getFiles(Array $criteria = array(), Array $orderBy = NULL) {
    $files = new \Psc\Data\ArrayCollection(
      $this->manager->getRepository()->findBy($criteria, $orderBy)
    );
    
    foreach ($files as $file) {
      $this->manager->attach($file);
    }
    
    return $files;
  }
1079709
private function filterAndSortByEncryptedField(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        $encryptedSort = $this->orderByHasEncryptedField($orderBy);

        $encryptedFields = $this->getEncryptedFields();
        $notEncryptedCriteria = array_diff_key($criteria, $encryptedFields);
        $notEncryptedOrderBy = !$encryptedSort ? $orderBy : null;

        // Get the result of the filter by not encrypted fields
        $result = $this->wrapped->findBy($notEncryptedCriteria, $notEncryptedOrderBy);

        $encryptedCriteria = array_intersect_key($criteria, $encryptedFields);
        if (!empty($result) && !empty($encryptedCriteria)) {
            $result = $this->filterWithEncryptedCriteria($result, $encryptedCriteria);
        }

        if ($encryptedSort && !empty($orderBy)) {
            $result = $this->sortWithEncryptedOrderBy($result, $orderBy);
        }

        if ($limit) {
            $offset = $offset ? $offset : 0;

            $result = array_slice($result, $offset, $limit);
        }

        return $result;
    }
789875
public function findOneBy(array $criteria, array $orderBy = null)
    {
        $criteria = array_merge($criteria, array("deleted" => false));

        return parent::findOneBy($criteria, $orderBy);
    }
222646
public function orderBy($orderBy = NULL) {
        if (isset($orderBy)) {
            $this->setOrderBy($orderBy);
            return $this;
        }
        return $this->getOrderBy();
    }