Advertisement
djuro95

CRUD

Feb 22nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. CRUD
  2.  
  3. php bin/console generate:doctrine:crud --entity=CarBundle:Car --format=annotation --with-write --no-interaction
  4.  
  5.  
  6. -CarController
  7.  
  8. annotation
  9.  
  10. /**
  11. *List all Car entities.
  12. *
  13. * @Route("/", name="car_index")
  14. * @Method("Get")
  15. * @Template() ++++++++++++
  16. */
  17. public function indexAction()
  18. {
  19. $em = $this->getDoctrine()->getManaget();
  20. $cars = $em->getRepository('Car')->findAll();
  21.  
  22. return array(
  23. 'cars' => $cars
  24. );
  25. }
  26.  
  27.  
  28. **********************
  29.  
  30. u Madel class ubacujemo
  31.  
  32. public function __toString()
  33. {
  34. return $this->getName();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement