Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <?php
  2.  
  3. public function deleteAction()
  4. {
  5. $toDoId = $this->params()->fromRoute('id', -1);
  6.  
  7. $toDo = $this->entityManager->getRepository(ToDo::class)->findOneById($toDoId);
  8. if ($toDo == null) {
  9. $this->getResponse()->setStatusCode(404);
  10. return;
  11. }
  12.  
  13. $this->toDoManager->removeToDo($toDo);
  14.  
  15. $this->redirect()->toUrl('/');
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement