Created
December 4, 2013 22:53
-
-
Save LuisRBarreras/7797100 to your computer and use it in GitHub Desktop.
Symfony2 Custom Repository Class Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Core\MainBundle\Entity; | |
use Doctrine\ORM\EntityRepository; | |
use Core\MainBundle\Entity\user; | |
class userRepository extends EntityRepository | |
{ | |
public function findUserByEmail($email, $password) | |
{ | |
$query = $this->getEntityManager() | |
->createQuery('SELECT u FROM CoreMainBundle:user u where u.email = :email and u.password = :password'); | |
$query->setParameter('email', $email); | |
$query->setParameter('password', $password); | |
return $query->getArrayResult(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment