Skip to content

Instantly share code, notes, and snippets.

@LuisRBarreras
Created December 4, 2013 22:53
Show Gist options
  • Save LuisRBarreras/7797100 to your computer and use it in GitHub Desktop.
Save LuisRBarreras/7797100 to your computer and use it in GitHub Desktop.
Symfony2 Custom Repository Class Example
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