Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection] Add an env function to DI expression language#45450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| thrownewLogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); | ||
| } | ||
| $this->expressionLanguage =newExpressionLanguage(null,$this->expressionLanguageProviders); | ||
| $this->expressionLanguage =newExpressionLanguage(null,$this->expressionLanguageProviders,null, \Closure::fromCallable([$this,'getEnv'])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is the only way I found to allow the expression language to fetch an env variable outside of a dumped container because of thegetEnv visibility but maybe we could make the method public instead.
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Nice, I like it :)
nicolas-grekas commentedFeb 18, 2022
Thank you@jvasseur. |
…xpression function (jvasseur)This PR was merged into the 6.1 branch.Discussion----------[DependencyInjection] Add documentation for the env DI expression functionDoc PR forsymfony/symfony#45450Commits-------bcbf1f3 Add documentation for the env DI expresion function
Uh oh!
There was an error while loading.Please reload this page.
This add an
envfunction to the DI expression language provider to ease creating expressions that depends on an environment variable.