Created
May 7, 2019 12:10
-
-
Save meshenka/c98d8b00b6ce380d96a3c92e1af1d455 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config/packages/demo.yaml | |
parameters: | |
# see https://symfony.com/doc/current/configuration/environment_variables.html#environment-variable-processors | |
env(MY_DISPATCH_EVENTS): true | |
services: | |
App\Demo\DemoService: | |
bind: | |
$dispatchEvents: '%env(bool:MY_DISPATCH_EVENTS)%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
si tu l'utilise dans tous les env, c'est une bonne chose de créer ton service à la racine /config/packages
demo.yaml
parameters:
see https://symfony.com/doc/current/configuration/environment_variables.html#environment-variable-processors
env(MY_DISPATCH_EVENTS): true
dispatchEvent: '%env(my_dispatch_events)%'
essais un ./bin/console debug:container --parameter dispatchEvents
pour t'assurer que ton parametre a été pris en compte.
Enfin, tu peut directement l'utiliser dans service.yaml:
services.yaml
services:
App\Demo\DemoService:
$dispatchEvent: '%dispatchEvent%'