@@ -1405,8 +1405,8 @@ Instead of duplicating the original route, you can create an alias for it.
1405
1405
1406
1406
class ProductController
1407
1407
{
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"
1410
1410
#[Route('/product/{id}', name: 'product_show', alias: ['product_details'])]
1411
1411
public function show(): Response
1412
1412
{
@@ -1451,17 +1451,21 @@ Instead of duplicating the original route, you can create an alias for it.
1451
1451
$routes->alias('product_details', 'product_show');
1452
1452
};
1453
1453
1454
+ .. versionadded :: 7.3
1455
+
1456
+ Support for route aliases in PHP attributes was introduced in Symfony 7.3.
1457
+
1454
1458
In this example, both ``product_show `` and ``product_details `` routes can
1455
1459
be used in the application and will produce the same result.
1456
1460
1457
1461
.. note ::
1458
1462
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 .
1461
1465
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.
1465
1469
1466
1470
.. _routing-alias-deprecation :
1467
1471
0 commit comments