Skip to content

Commit 32e93b8

Browse files
committed
Tweaks and added the versionadded directive
1 parent 0b3db8e commit 32e93b8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

routing.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,8 +1405,8 @@ Instead of duplicating the original route, you can create an alias for it.
14051405
14061406
class ProductController
14071407
{
1408-
// "alias" named argument indicates the name of the alias you want to create.
1409-
// The alias will point to the actual route "product_show"
1408+
// the "alias" argument assigns an alternate name to this route;
1409+
// the alias will point to the actual route "product_show"
14101410
#[Route('/product/{id}', name: 'product_show', alias: ['product_details'])]
14111411
public function show(): Response
14121412
{
@@ -1451,17 +1451,21 @@ Instead of duplicating the original route, you can create an alias for it.
14511451
$routes->alias('product_details', 'product_show');
14521452
};
14531453
1454+
.. versionadded:: 7.3
1455+
1456+
Support for route aliases in PHP attributes was introduced in Symfony 7.3.
1457+
14541458
In this example, both ``product_show`` and ``product_details`` routes can
14551459
be used in the application and will produce the same result.
14561460

14571461
.. note::
14581462

1459-
Using non-attributes formats (YAML, XML and PHP) is the only way
1460-
to define an alias pointing to a route that you don't own.
1463+
YAML, XML, and PHP configuration formats are the only ways to define an alias
1464+
for a route that you do not own. You can't do this when using PHP attributes.
14611465

1462-
So that you can use your own route name for URL generation,
1463-
while actually using a route defined by a third-party bundle as the target of that URL generation,
1464-
as the 2 definitions are not required to be in the same config file (or even in the same format).
1466+
This allows you for example to use your own route name for URL generation,
1467+
while still targeting a route defined by a third-party bundle. The alias and
1468+
the original route do not need to be declared in the same file or format.
14651469

14661470
.. _routing-alias-deprecation:
14671471

0 commit comments

Comments
 (0)