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 @@ -687,8 +687,12 @@ the relationship between the removed ``Tag`` and ``Task`` object.
687687 use Doctrine\Common\Collections\ArrayCollection;
688688
689689 // ...
690- public function edit(Task $task , Request $request, EntityManagerInterface $entityManager)
690+ public function edit($id , Request $request, EntityManagerInterface $entityManager)
691691 {
692+ if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
693+ throw $this->createNotFoundException('No task found for id '.$id);
694+ }
695+
692696 $originalTags = new ArrayCollection();
693697
694698 // Create an ArrayCollection of the current Tag objects in the database
@@ -701,7 +705,6 @@ the relationship between the removed ``Tag`` and ``Task`` object.
701705 $editForm->handleRequest($request);
702706
703707 if ($editForm->isSubmitted() && $editForm->isValid()) {
704-
705708 // remove the relationship between the tag and the Task
706709 foreach ($originalTags as $tag) {
707710 if (false === $task->getTags()->contains($tag)) {
You can’t perform that action at this time.
0 commit comments