public function create($data, Question $question) { $obj = new Answer(); $obj->setTextAnswer($data['textAnswer'])->setCorrectAnswer($data['correctAnswer'])->setQuestion($question); $this->_em->persist($obj); $this->_em->flush($obj); return $obj; }
/** * Creates a form to delete a Answer entity. * * @param Answer $answer The Answer entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Answer $answer) { return $this->createFormBuilder()->setAction($this->generateUrl('answer_delete', ['id' => $answer->getId()]))->setMethod('DELETE')->getForm(); }