Skip to content

Commit b429aae

Browse files
committed
fix(route-alias): Add a note about aliasing 3rd-party routes
1 parent 848f249 commit b429aae

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

routing.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ Instead of duplicating the original route, you can create an alias for it.
14031403
14041404
class ProductController
14051405
{
1406-
// "alias" named argument refers to the name of the alias you want to create.
1406+
// "alias" named argument indicates the name of the alias you want to create.
14071407
// The alias will point to the actual route "product_show"
14081408
#[Route('/product/{id}', name: 'product_show', alias: ['product_details'])]
14091409
public function show(): Response
@@ -1452,6 +1452,15 @@ Instead of duplicating the original route, you can create an alias for it.
14521452
In this example, both ``product_show`` and ``product_details`` routes can
14531453
be used in the application and will produce the same result.
14541454

1455+
.. note::
1456+
1457+
Using non-attributes formats (YAML, XML and PHP) is the only way
1458+
to define an alias pointing to a route that you don't own.
1459+
1460+
So that you can use your own route name for URL generation,
1461+
while actually using a route defined by a third-party bundle as the target of that URL generation,
1462+
as the 2 definitions are not required to be in the same config file (or even in the same format).
1463+
14551464
.. _routing-alias-deprecation:
14561465

14571466
Deprecating Route Aliases

0 commit comments

Comments
 (0)