You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1349,6 +1375,44 @@ you decided not to maintain it anymore), you can deprecate its definition:
1349
1375
1350
1376
.. configuration-block::
1351
1377
1378
+
.. code-block:: php-attributes
1379
+
1380
+
// src/Controller/DefaultController.php
1381
+
namespace App\Controller;
1382
+
1383
+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1384
+
use Symfony\Component\HttpFoundation\Response;
1385
+
use Symfony\Component\Routing\Attribute\Route;
1386
+
1387
+
class DefaultController extends AbstractController
1388
+
{
1389
+
// this outputs the following generic deprecation message:
1390
+
// Since acme/package 1.2: The "new_route_name" route alias is deprecated. You should stop using it, as it will be removed in the future.
1391
+
#[Route('/path',
1392
+
name: 'new_route_name',
1393
+
alias: new DeprecatedAlias(aliasName: 'original_route_name', package: 'acme/package', version: '1.2')
1394
+
)]
1395
+
// you can also define a custom deprecation message (%alias_id% placeholder is available)
1396
+
#[Route('/path',
1397
+
name: 'new_route_name',
1398
+
alias: new DeprecatedAlias(aliasName: 'original_route_name', package: 'acme/package', version: '1.2', message: 'The "%alias_id%" route alias is deprecated. Do not use it anymore.')
1399
+
)]
1400
+
public function action(): Response
1401
+
{
1402
+
// ...
1403
+
}
1404
+
1405
+
#[Route('/path', name: 'new_route_name', alias: [
1406
+
new DeprecatedAlias('first_original_route_name', 'acme/package', '1.0'),
1407
+
new DeprecatedAlias('second_original_route_name', 'acme/package', '2.0'),
1408
+
new DeprecatedAlias('third_original_route_name', 'acme/package', '3.0'),
0 commit comments