original_string: 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();
      }
code: 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();
      }
code_tokens: 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 ( ) ; }
docstring: Find user by query
  
  @param String $query
  @deprecated since 0.19 not used anymore and probably broken.
  @return object
docstring_tokens: Find user by query