8000 [Routing] add mapped route parameters and aliases by eltharin · Pull Request #20812 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Routing] add mapped route parameters and aliases #20812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MrYamous changes
  • Loading branch information
eltharin committed Mar 25, 2025
commit c0ead98d1883fcdcb84d428f3cb8597141caee80
6 changes: 4 additions & 2 deletions doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ In this case we have to return to MapEntiy::
#[Route('/document/{slugCategory}/{id}-{slugDocument}')]
public function showDocument(
#[MapEntity(mapping: ['slugCategory' => 'slug'])]
Category $category
Category $category,
#[MapEntity(mapping: ['id' => 'id', 'slugDocument' => 'slug'])]
Document $document,
): Response
Expand All @@ -931,7 +931,9 @@ When adding route parameters, you can now define the mapping between the route p
// $category = $categoryRepository->findOneBy(['slug' => 'the slug category']);
}

In this case, _route_mapping keys will be slugCategory and slugDocument, and used by path twig option::
In this case, _route_mapping keys will be slugCategory and slugDocument, and used by path twig option.

.. code-block:: twig

{{ path('showDocument', {slugCategory: 'invoices', id: 25, slugDocument: 'invoice_CFD025125'}) }}

Expand Down
0