getDoctrine()->getManager(); $previouslyOwnedFlashes = $em->getRepository('CameraBundle:PreviouslyOwnedFlash')->findBy([], [ 'brand' => 'ASC', 'model' => 'ASC' ]); return $this->render('previouslyownedflash/index.html.twig', array( 'previouslyOwnedFlashes' => $previouslyOwnedFlashes, )); } /** * Creates a new previouslyOwnedFlash entity. * * @Route("/new", name="previously-owned-flash_new") * @Method({"GET", "POST"}) */ public function newAction(Request $request) { $previouslyOwnedFlash = new Previouslyownedflash(); $form = $this->createForm('CameraBundle\Form\PreviouslyOwnedFlashType', $previouslyOwnedFlash); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($previouslyOwnedFlash); $em->flush(); return $this->redirectToRoute('previously-owned-flash_show', array('id' => $previouslyOwnedFlash->getId())); } return $this->render('previouslyownedflash/new.html.twig', array( 'previouslyOwnedFlash' => $previouslyOwnedFlash, 'form' => $form->createView(), )); } /** * Finds and displays a previouslyOwnedFlash entity. * * @Route("/{id}", name="previously-owned-flash_show") * @Method("GET") */ public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash) { return $this->render('previouslyownedflash/show.html.twig', array( 'previouslyOwnedFlash' => $previouslyOwnedFlash )); } /** * Displays a form to edit an existing previouslyOwnedFlash entity. * * @Route("/{id}/edit", name="previously-owned-flash_edit") * @Method({"GET", "POST"}) */ public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash) { $editForm = $this->createForm('CameraBundle\Form\PreviouslyOwnedFlashType', $previouslyOwnedFlash); $editForm->handleRequest($request); if ($editForm->isSubmitted() && $editForm->isValid()) { $this->getDoctrine()->getManager()->flush(); return $this->redirectToRoute('previously-owned-flash_edit', array('id' => $previouslyOwnedFlash->getId())); } return $this->render('previouslyownedflash/edit.html.twig', array( 'previouslyOwnedFlash' => $previouslyOwnedFlash, 'edit_form' => $editForm->createView(), )); } }