File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -875,26 +875,24 @@ it is mandatory to use ``#[MapEntity]`` attributes and this can become cumbersom
875
875
Document $document,
876
876
): Response
877
877
{
878
- // the database queries in this case would be :
878
+ // this would result in the following database queries :
879
879
// $document = $documentRepository->findOneBy(['id' => 'the id', 'name' => 'the name']);
880
880
// $category = $categoryRepository->findOneBy(['slug' => 'the slug']);
881
881
}
882
882
883
- As an alternative, you can also use Mapped Route Parameters.
884
-
885
- When adding route parameters, you can now define the mapping between the route parameter and the controller argument::
883
+ By using mapped route parameters, you can define the mapping between the route parameter and the controller argument::
886
884
887
885
#[Route('/document/{slug:category}/{id:document}-{name:document}')]
888
886
public function showDocument(Document $document, Category $category): Response
889
887
{
890
- // the database queries in this case would be :
888
+ // this would result in the following database queries :
891
889
// $document = $documentRepository->findOneBy(['id' => 'the id', 'name' => 'the name']);
892
890
// $category = $categoryRepository->findOneBy(['slug' => 'the slug']);
893
891
}
894
892
895
893
.. versionadded :: 7.1
896
894
897
- The mapped route parameters were introduced in Symfony 7.1.
895
+ Mapped route parameters were introduced in Symfony 7.1.
898
896
899
897
Updating an Object
900
898
------------------
You can’t perform that action at this time.
0 commit comments