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.
655
655
use Doctrine\Common\Collections\ArrayCollection;
656
656
657
657
// ...
658
- public function edit(Task $task , Request $request, EntityManagerInterface $entityManager)
658
+ public function edit($id , Request $request, EntityManagerInterface $entityManager)
659
659
{
660
+ if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
661
+ throw $this->createNotFoundException('No task found for id '.$id);
662
+ }
663
+
660
664
$originalTags = new ArrayCollection();
661
665
662
666
// Create an ArrayCollection of the current Tag objects in the database
@@ -669,7 +673,6 @@ the relationship between the removed ``Tag`` and ``Task`` object.
669
673
$editForm->handleRequest($request);
670
674
671
675
if ($editForm->isSubmitted() && $editForm->isValid()) {
672
-
673
676
// remove the relationship between the tag and the Task
674
677
foreach ($originalTags as $tag) {
675
678
if (false === $task->getTags()->contains($tag)) {
You can’t perform that action at this time.
0 commit comments