public function findOneBy(array $criteria)
    {
        $users = $this->findBy($criteria);

        if (empty($users)) {
            return null;
        }

        return reset($users);
    }
public function findOneBy(array $criteria)
    {
        $users = $this->findBy($criteria);

        if (empty($users)) {
            return null;
        }

        return reset($users);
    }
public function findOneBy ( array $ criteria ) { $ users = $ this -> findBy ( $ criteria ) ; if ( empty ( $ users ) ) { return null ; } return reset ( $ users ) ; }
Get a single User instance that matches the given criteria. If more than one User matches, the first result is returned.

@param array $criteria
@return User|null
Get a single User instance that matches the given criteria . If more than one User matches the first result is returned .