Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'admin@domain.com' for key 'UNIQ_1483A5E9E7927C74'
  2.  
  3. public function getSameFriends ($email)
  4. {
  5. $q = $this->createQueryBuilder('f');
  6.  
  7. $q->select('f')
  8. ->where('f.email = :email')
  9. ->setParameter('email', $email);
  10.  
  11. return $q->getQuery()->getSingleScalarResult();
  12. }
  13.  
  14. $em = $this->getDoctrine()->getEntityManager();
  15. $count = $em->getRepository('EMMyFriendsBundle:Friend')
  16. ->getSameFriends($friend->getEmail());
  17. if($count != 0)
  18. {
  19. $this->get('session')->setFlash('notice', 'There already is a friend with this email!');
  20. return $this->redirect($this->generateUrl('home_display'));
  21. }
  22.  
  23. No result was found for query although at least one row was expected.
  24. 500 Internal Server Error - NoResultException
  25.  
  26. return count($q->getQuery()->getResult());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement