protected function execute(InputInterface $input, OutputInterface $output)
 {
     $domain = new \Hollo\BindBundle\Entity\Domain();
     $domain->setDomain($input->getArgument('domain'));
     $domain->setAddress($input->getArgument('address'));
     $domain->setDescription($input->getArgument('description'));
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $em->persist($domain);
     $em->flush();
     $event = new \Hollo\BindBundle\Event\FilterDomainEvent($domain);
     $this->getContainer()->get('event_dispatcher')->dispatch(\Hollo\BindBundle\Event\Events::onDomainAdd, $event);
     $output->writeln(sprintf('Added domain <comment>%s</comment>', $domain->getDomain()));
 }
 /**
  * @Template()
  * @Route("/domain/new")
  */
 public function newAction()
 {
     $domain = new \Hollo\BindBundle\Entity\Domain();
     $domain->setAddress('127.0.0.1');
     $domain->setType('domain');
     $form = $this->createForm(new \Hollo\BindBundle\Form\Domain(), $domain);
     if ($this->getRequest()->getMethod() == 'POST') {
         $form->bindRequest($this->getRequest());
         if ($form->isValid()) {
             $em = $this->getDoctrine()->getEntityManager();
             $em->persist($domain);
             $em->flush();
             $event = new \Hollo\BindBundle\Event\FilterDomainEvent($domain);
             $this->get('event_dispatcher')->dispatch(\Hollo\BindBundle\Event\Events::onDomainAdd, $event);
             $this->get('session')->setFlash('notice', 'Your data has been saved.');
             return $this->redirect($this->generateUrl('hollo_bind_admindomain_index'));
         }
     }
     return array('form' => $form->createView());
 }