Yaron-NL

Date checker Symfony2

May 8th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1.  if ($form->isValid()) {
  2.             $em = $this->getDoctrine()->getManager();
  3.             $bookEntity = $em->getRepository("AppBundle:book")->findBy(array("date" => $req->getDate()));
  4.  
  5.             if (count($bookEntity) == 0) {
  6.                 $em->persist($req);
  7.                 $em->flush();
  8.                 return $this->redirectToRoute("homepage");
  9.             }elseif(count($bookEntity) == 1){
  10.               //  return new Response ('Er is al iets gepland');
  11.                 echo "Error";
  12.             }
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment