Example #1
0
 /**
  * Creates new entity
  *
  * @return FormInterface
  */
 public function execute()
 {
     $form = $this->formFactory->createNamed('', $this->type);
     $form->handleRequest($this->stack->getCurrentRequest());
     if ($form->isValid()) {
         $object = $form->getData();
         $this->repository->add($object);
         $this->postCreate($object);
         return $object;
     }
     return $form;
 }