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 +1373,44 @@ you decided not to maintain it anymore), you can deprecate its definition:
1349
1373
1350
1374
.. configuration-block::
1351
1375
1376
+
.. code-block:: php-attributes
1377
+
1378
+
// src/Controller/DefaultController.php
1379
+
namespace App\Controller;
1380
+
1381
+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1382
+
use Symfony\Component\HttpFoundation\Response;
1383
+
use Symfony\Component\Routing\Attribute\Route;
1384
+
1385
+
class DefaultController extends AbstractController
1386
+
{
1387
+
// this outputs the following generic deprecation message:
1388
+
// 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.
1389
+
#[Route('/path',
1390
+
name: 'new_route_name',
1391
+
alias: new DeprecatedAlias('original_route_name', 'MyBundleFixture', '1.0')
1392
+
)]
1393
+
// you can also define a custom deprecation message (%alias_id% placeholder is available)
1394
+
#[Route('/path',
1395
+
name: 'new_route_name',
1396
+
alias: new DeprecatedAlias('original_route_name', 'acme/package', '1.2', message: 'The "%alias_id%" route alias is deprecated. Do not use it anymore.')
1397
+
)]
1398
+
public function action(): Response
1399
+
{
1400
+
// ...
1401
+
}
1402
+
1403
+
#[Route('/path', name: 'new_route_name', alias: [
1404
+
new DeprecatedAlias('first_original_route_name', 'acme/package', '1.0'),
1405
+
new DeprecatedAlias('second_original_route_name', 'acme/package', '2.0'),
1406
+
new DeprecatedAlias('third_original_route_name', 'acme/package', '3.0'),
0 commit comments