get('hash'); } else { $hash = $this->getPasswordHash()->hash($password); } $user = $this->getEntityManager()->getRepository('User')->findOne(array( 'whereClause' => array( 'userName' => $username, 'password' => $hash ), )); return $user; } }