public function findByQuery($query)
    {
        $qb = $this->createQueryBuilder();
        $parts  = explode(' ', trim($query));
        
        foreach ($parts as $q) {
            $regex = new \MongoRegex('/^' . $query . '/i');
            $qb->addOr($qb->expr()->field('info.firstName')->equals($regex));
            $qb->addOr($qb->expr()->field('info.lastName')->equals($regex));
            $qb->addOr($qb->expr()->field('info.email')->equals($regex));
        }
        $qb->sort(array('info.lastName' => 1))
           ->sort(array('info.email' => 1));
        
        return $qb->getQuery()->execute();
    }
public function findByQuery($query)
    {
        $qb = $this->createQueryBuilder();
        $parts  = explode(' ', trim($query));
        
        foreach ($parts as $q) {
            $regex = new \MongoRegex('/^' . $query . '/i');
            $qb->addOr($qb->expr()->field('info.firstName')->equals($regex));
            $qb->addOr($qb->expr()->field('info.lastName')->equals($regex));
            $qb->addOr($qb->expr()->field('info.email')->equals($regex));
        }
        $qb->sort(array('info.lastName' => 1))
           ->sort(array('info.email' => 1));
        
        return $qb->getQuery()->execute();
    }
public function findByQuery ( $ query ) { $ qb = $ this -> createQueryBuilder ( ) ; $ parts = explode ( ' ' , trim ( $ query ) ) ; foreach ( $ parts as $ q ) { $ regex = new \ MongoRegex ( '/^' . $ query . '/i' ) ; $ qb -> addOr ( $ qb -> expr ( ) -> field ( 'info.firstName' ) -> equals ( $ regex ) ) ; $ qb -> addOr ( $ qb -> expr ( ) -> field ( 'info.lastName' ) -> equals ( $ regex ) ) ; $ qb -> addOr ( $ qb -> expr ( ) -> field ( 'info.email' ) -> equals ( $ regex ) ) ; } $ qb -> sort ( array ( 'info.lastName' => 1 ) ) -> sort ( array ( 'info.email' => 1 ) ) ; return $ qb -> getQuery ( ) -> execute ( ) ; }
Find user by query

@param String $query
@deprecated since 0.19 not used anymore and probably broken.
@return object
Find user by query