Esempio n. 1
0
 /**
  * Creates a new Anuncios entity.
  *
  */
 public function newAction(Request $request)
 {
     $anuncio = new Anuncios();
     $animal = new Animales();
     $user = new User();
     $anuncio->setUser($this->getUser());
     $animal->setAnuncio($anuncio);
     $anuncio->setAnimal($animal);
     $form = $this->createForm('AnunciosBundle\\Form\\AnunciosType', $anuncio);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($anuncio);
         $em->flush();
         return $this->redirectToRoute('anuncios_show', array('id' => $anuncio->getId()));
     }
     return $this->render('anuncios/new.html.twig', array('anuncio' => $anuncio, 'form' => $form->createView()));
 }
 /**
  * {@inheritDoc}
  */
 public function getPedigri()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPedigri', []);
     return parent::getPedigri();
 }
Esempio n. 3
0
 /**
  * Creates a form to delete a Animales entity.
  *
  * @param Animales $animale The Animales entity
  *
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Animales $animale)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('animales_delete', array('id' => $animale->getId())))->setMethod('DELETE')->getForm();
 }