public function findByUsername($username)
    {
        $qb = $this->createQueryBuilder("u");
        $qb->where("(u.username = :username OR u.email = :email)")
            ->setParameter("username", $username)
            ->setParameter("email", $username);
        $qb->andWhere("u.status = :status")->setParameter("status", 1);
        $qb->setMaxResults(1);
        return $qb->getQuery()->getOneOrNullResult();
    }
public function findByUsername($username)
    {
        $qb = $this->createQueryBuilder("u");
        $qb->where("(u.username = :username OR u.email = :email)")
            ->setParameter("username", $username)
            ->setParameter("email", $username);
        $qb->andWhere("u.status = :status")->setParameter("status", 1);
        $qb->setMaxResults(1);
        return $qb->getQuery()->getOneOrNullResult();
    }
public function findByUsername ( $ username ) { $ qb = $ this -> createQueryBuilder ( "u" ) ; $ qb -> where ( "(u.username = :username OR u.email = :email)" ) -> setParameter ( "username" , $ username ) -> setParameter ( "email" , $ username ) ; $ qb -> andWhere ( "u.status = :status" ) -> setParameter ( "status" , 1 ) ; $ qb -> setMaxResults ( 1 ) ; return $ qb -> getQuery ( ) -> getOneOrNullResult ( ) ; }
Find by username.
@param  string $username A username.
@return User           The user.
Find by username .