Skip to content

Commit 226f4b9

Browse files
hbgamrajaviereguiluz
authored andcommitted
Task object instead of id as param
Thanks to paramconverter we can get Task object directly instea of putting the ID and w can throw automaically an exception if it's not found
1 parent 56f05a8 commit 226f4b9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

form/form_collections.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,8 @@ the relationship between the removed ``Tag`` and ``Task`` object.
598598

599599
class TaskController extends AbstractController
600600
{
601-
public function edit($id, Request $request, EntityManagerInterface $entityManager): Response
601+
public function edit(Task $task, Request $request, EntityManagerInterface $entityManager): Response
602602
{
603-
if (null === $task = $entityManager->getRepository(Task::class)->find($id)) {
604-
throw $this->createNotFoundException('No task found for id '.$id);
605-
}
606-
607603
$originalTags = new ArrayCollection();
608604

609605
// Create an ArrayCollection of the current Tag objects in the database

0 commit comments

Comments
 (0)