public function create($title, Level $level) { $obj = new Question(); $obj->setTitle($title)->setLevel($level); $this->_em->persist($obj); $this->_em->flush($obj); return $obj; }
/** * Creates a form to delete a Question entity. * * @param Question $question The Question entity * * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm(Question $question) { return $this->createFormBuilder()->setAction($this->generateUrl('question_delete', ['id' => $question->getId()]))->setMethod('DELETE')->getForm(); }