File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -655,8 +655,12 @@ the relationship between the removed ``Tag`` and ``Task`` object.
655655 use Doctrine\Common\Collections\ArrayCollection;
656656
657657 // ...
658- public function edit(Task $task , Request $request, EntityManagerInterface $entityManager)
658+ public function edit($id , Request $request, EntityManagerInterface $entityManager)
659659 {
660+ if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
661+ throw $this->createNotFoundException('No task found for id '.$id);
662+ }
663+
660664 $originalTags = new ArrayCollection();
661665
662666 // Create an ArrayCollection of the current Tag objects in the database
@@ -669,7 +673,6 @@ the relationship between the removed ``Tag`` and ``Task`` object.
669673 $editForm->handleRequest($request);
670674
671675 if ($editForm->isSubmitted() && $editForm->isValid()) {
672-
673676 // remove the relationship between the tag and the Task
674677 foreach ($originalTags as $tag) {
675678 if (false === $task->getTags()->contains($tag)) {
You can’t perform that action at this time.
0 commit comments