private function getUsersByCriteria(Criteria $criteria)
    {
        $repository = $this->om->getRepository($this->modelName);

        if ($repository instanceof Selectable) {
            $filteredUsers = $repository->matching($criteria);
        } else {
            $allUsers = new ArrayCollection($repository->findAll());
            $filteredUsers = $allUsers->matching($criteria);
        }

        return $filteredUsers->toArray();
    }
private function getUsersByCriteria(Criteria $criteria)
    {
        $repository = $this->om->getRepository($this->modelName);

        if ($repository instanceof Selectable) {
            $filteredUsers = $repository->matching($criteria);
        } else {
            $allUsers = new ArrayCollection($repository->findAll());
            $filteredUsers = $allUsers->matching($criteria);
        }

        return $filteredUsers->toArray();
    }
private function getUsersByCriteria ( Criteria $ criteria ) { $ repository = $ this -> om -> getRepository ( $ this -> modelName ) ; if ( $ repository instanceof Selectable ) { $ filteredUsers = $ repository -> matching ( $ criteria ) ; } else { $ allUsers = new ArrayCollection ( $ repository -> findAll ( ) ) ; $ filteredUsers = $ allUsers -> matching ( $ criteria ) ; } return $ filteredUsers -> toArray ( ) ; }
Simple utility to query users by a given criteria.

As there's no unified query language defined in doctrine/common, the criteria tool of doctrine/collections
should help. The ORM and Mongo-ODM support the `Selectable` API which means that they can build native
DB queries for their database based on a criteria object. The other official implementations PHPCR and CouchDB-ODM
don't support that, so they have to be evaluated manually.

@param Criteria $criteria

@return object[]
Simple utility to query users by a given criteria .