From 247c19423c7072833f1a6b2485d0670709cac671 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Thu, 9 Jun 2022 10:20:24 -0400 Subject: [PATCH] tag the service so it can be used in the route condition, #99 --- docs/route.md | 12 ++++++++++++ src/Resources/config/services.yml | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/route.md b/docs/route.md index d68465e..abb296b 100644 --- a/docs/route.md +++ b/docs/route.md @@ -48,6 +48,18 @@ class BlogController extends Controller } } ``` + +Symfony 6.1+ can check for the feature in the condition +```php + /** + * @Route("/blog/{page}", condition="service('flagception.manager.feature_manager').isActive('feature_123')") + */ + public function listAction($page) + { + // ... + } +``` + or via yml ```yml diff --git a/src/Resources/config/services.yml b/src/Resources/config/services.yml index fe3e24e..b2fd401 100644 --- a/src/Resources/config/services.yml +++ b/src/Resources/config/services.yml @@ -1,11 +1,13 @@ services: flagception.manager.feature_manager: class: Flagception\Manager\FeatureManager + tags: + - { name: routing.condition_service } arguments: - '@flagception.activator.chain_activator' - '@flagception.decorator.chain_decorator' public: true - + Flagception\Manager\FeatureManagerInterface: '@flagception.manager.feature_manager' flagception.expression_language: