/** * * @param array $params * @return Joke */ public function insert(array $params) { $joke = Joke::fromArray($params); $rawJoke = $this->gateway->insert($joke); return $this->factory->makeOne($rawJoke); }
/** * * @Route("/jokes/{id}/delete/confirm", name="app_jokes_delete_confirm") * @Method({"DELETE"}) * @ParamConverter("joke", class="AppBundle:Joke", options={ * "repository_method" = "findOneBy", * "mapping": { * "id": "id" * }, * }) * @param Request $request * @param Joke $joke * @return RedirectResponse * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException */ public function deleteConfirmController(Request $request, Joke $joke) { $form = $this->createDeleteForm($joke->getId()); $form->handleRequest($request); if ($form->isValid()) { $this->get('app.joke_repository')->remove($joke); return $this->redirect($this->generateUrl('app_jokes')); } throw new \Symfony\Component\Form\Exception\InvalidConfigurationException('Invalid delete form submision.'); }