src/Tomahawk/Bundle/DoctrineBundle/Authentication/User/DoctrineUserProvider.php
public function findUserByUsername($username)
    {
        return $this->registry->getRepository($this->userClass)
            ->findOneBy(array(
                $this->username => $username
            ));
    }
public function findUserByUsername($username)
    {
        return $this->registry->getRepository($this->userClass)
            ->findOneBy(array(
                $this->username => $username
            ));
    }
Find user by username

@param $username
@return UserInterface|null