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.
687
687
use Doctrine\Common\Collections\ArrayCollection;
688
688
689
689
// ...
690
- public function edit(Task $task , Request $request, EntityManagerInterface $entityManager)
690
+ public function edit($id , Request $request, EntityManagerInterface $entityManager)
691
691
{
692
+ if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
693
+ throw $this->createNotFoundException('No task found for id '.$id);
694
+ }
695
+
692
696
$originalTags = new ArrayCollection();
693
697
694
698
// Create an ArrayCollection of the current Tag objects in the database
@@ -701,7 +705,6 @@ the relationship between the removed ``Tag`` and ``Task`` object.
701
705
$editForm->handleRequest($request);
702
706
703
707
if ($editForm->isSubmitted() && $editForm->isValid()) {
704
-
705
708
// remove the relationship between the tag and the Task
706
709
foreach ($originalTags as $tag) {
707
710
if (false === $task->getTags()->contains($tag)) {
You can’t perform that action at this time.
0 commit comments