Ejemplo n.º 1
0
 /**
  * Creates a new Project entity.
  *
  */
 public function createAction(Request $request)
 {
     $entity = new Project();
     $form = $this->createCreateForm($entity);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($entity);
         $em->flush();
         // Create Style
         $style = new Style();
         $style->setProject($entity);
         $em->persist($style);
         $em->flush();
         //Set Project Style
         $entity->setStyle($style);
         $em->flush();
         return $this->redirect($this->generateUrl('backend_project_edit', array('id' => $entity->getId())));
     }
     return $this->render('SiteMainBundle:Backend/Project:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
 }
Ejemplo n.º 2
0
 /**
  * Set style
  *
  * @param \Site\MainBundle\Entity\Style $style
  * @return Project
  */
 public function setStyle(\Site\MainBundle\Entity\Style $style = null)
 {
     $this->style = $style;
     $style->setProject($this);
     return $this;
 }