Doctrine - check if record based on field exists

Using the doctrine in symfony2, I have a simple user model with the following fields:

Username
Email
Password

How to download a model based on email address?

+5
source share
1 answer
$user = $this->getDoctrine()
             ->getRepository('YourBundle:User')
             ->findOneBy(array('email' => $email));

Read the official doctrine orm documentation about this

+10
source

All Articles