/** * Displays a form to create a new Document entity. * * @Route("/new", name="finance_document_si_new") * @Method("GET") * @Template() */ public function newAction() { $document = new Document(); $document->setDate(new \DateTime()); $document->setDueDate(new \DateTime()); $type = $this->getDoctrine()->getManager()->getRepository('FlowerFinancesBundle:DocumentType')->findOneBy(array('name' => \Flower\FinancesBundle\Entity\DocumentType::TYPE_SUPPLIER_INVOICE)); $document->setType($type); $form = $this->createForm($this->get('finances.form.type.supplier_invoice'), $document); return array('document' => $document, 'form' => $form->createView()); }