/** * @param FormInterface $form * @param PostInterface $post * @param string $recipient */ public function sendConfirmationMail(FormInterface $form, PostInterface $post, $recipient) { $body = $this->templating->render('OpiferFormBundle:Email:confirmation.html.twig', ['post' => $post]); $message = $this->createMessage($recipient, $form->getName(), $body); $this->send($message); }
/** * Create a Symfony Form instance * * @param FormInterface $form * @param PostInterface $post * * @return \Symfony\Component\Form\FormInterface */ public function createForm(FormInterface $form, PostInterface $post) { return $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]); }
/** * Builds a Symfony form from the passed Form entity and returns the related FormView, * so we can use our Form as a standard Symfony form in our templates. * * @param FormInterface $form * * @return \Symfony\Component\Form\FormView */ public function createFormView(FormInterface $form) { $post = $this->eavManager->initializeEntity($form->getSchema()); $form = $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]); return $form->createView(); }