protected function execute(InputInterface $input, OutputInterface $output) { $options = $input->getOptions(); $transport = new \Hollo\PostfixBundle\Entity\Transport(); $transport->setDomain($options['domain']); $transport->setTransport($options['transport']); $em = $this->getContainer()->get('doctrine.orm.entity_manager'); $em->persist($transport); $em->flush(); return 0; }
public function newAction() { $transport = new \Hollo\PostfixBundle\Entity\Transport(); $transport->setTransport('smtp:'); $form = $this->createForm(new \Hollo\PostfixBundle\Form\Transport(), $transport); if ($this->getRequest()->getMethod() == 'POST') { $form->bindRequest($this->getRequest()); if ($form->isValid()) { $em = $this->getDoctrine()->getEntityManager(); $em->persist($transport); $em->flush(); $this->get('session')->setFlash('notice', 'Transport added'); return $this->redirect($this->generateUrl('homepage')); } } return $this->render('HolloPostfixBundle:Default:new.html.twig', array('form' => $form->createView())); }