Doctrine - check if record exists based on field

前端 未结 1 1672
清歌不尽
清歌不尽 2020-12-07 02:25

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

Username
Email
Password

How can I load the model based on

相关标签:
1条回答
  • 2020-12-07 02:46
    $user = $this->getDoctrine()
                 ->getRepository('YourBundle:User')
                 ->findOneBy(array('email' => $email));
    

    Please read the official doctrine orm documentation about this

    0 讨论(0)
提交回复
热议问题