src/User/UserEditService.php
public function getChoices($username = null, $email = null, $or = false, $limit = null)
    {
        $qb = $this->getRepository()->createQueryBuilder('u');
        $qb->orderBy('u.username');
        $method = $or ? 'orWhere' : 'andWhere';
        if ($username) {
            $qb->$method('u.username LIKE :username');
            $qb->setParameter('username', '%' . $username . '%');
        }
        if ($email) {
            $qb->$method('u.email LIKE :email');
            $qb->setParameter('email', '%' . $email . '%');
        }
        if ($limit) {
            $qb->setMaxResults($limit);
        }

        return $qb->getQuery()->getResult();
    }
public function getChoices($username = null, $email = null, $or = false, $limit = null)
    {
        $qb = $this->getRepository()->createQueryBuilder('u');
        $qb->orderBy('u.username');
        $method = $or ? 'orWhere' : 'andWhere';
        if ($username) {
            $qb->$method('u.username LIKE :username');
            $qb->setParameter('username', '%' . $username . '%');
        }
        if ($email) {
            $qb->$method('u.email LIKE :email');
            $qb->setParameter('email', '%' . $email . '%');
        }
        if ($limit) {
            $qb->setMaxResults($limit);
        }

        return $qb->getQuery()->getResult();
    }
public function getChoices ( $ username = null , $ email = null , $ or = false , $ limit = null ) { $ qb = $ this -> getRepository ( ) -> createQueryBuilder ( 'u' ) ; $ qb -> orderBy ( 'u.username' ) ; $ method = $ or ? 'orWhere' : 'andWhere' ; if ( $ username ) { $ qb -> $ method ( 'u.username LIKE :username' ) ; $ qb -> setParameter ( 'username' , '%' . $ username . '%' ) ; } if ( $ email ) { $ qb -> $ method ( 'u.email LIKE :email' ) ; $ qb -> setParameter ( 'email' , '%' . $ email . '%' ) ; } if ( $ limit ) { $ qb -> setMaxResults ( $ limit ) ; } return $ qb -> getQuery ( ) -> getResult ( ) ; }
Find user choices

@param string $username
@param string $email
@param bool   $or       combine search params with OR
@param int    $limit    Limit the number of results

@return array
Find user choices