-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Deprecate the global variables in Twig in favor of Twig functions #13356
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Is it possible to chain function calls, i.e. |
@Tobion, yes, you can chain them. |
In case of |
@iltar symfony 2 has no magic anymore and this doesn't work generically. Why would it be a shortcut for |
@Tobion It's not magic and why shouldn't it work?
Edit: Why get and not something else? Because why would you set something in the request in your template? That's a bad practice IMO. If you want something else: |
@iltar, because you do many things with a Request besides getting a value from the query/request/cookie/... |
@fabpot in the controller I would agree. In the template I think you don't want to have that all available. |
Doing a However, I tend to agree a bit with what @hhamon said in the previous PR:
|
ping @symfony/deciders Good idea or not? |
@iltar IMO, it is important to be able to get a param from the query string or from the attributes only. Allowing to get it from the query string when you expect it to be in the attributes can even be a security issue in your app depending of what you do with it, because the user can put what he wants in the query string. So calling |
* {@inheritdoc} | ||
* Returns the current user. | ||
* | ||
* @return mixed |
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.
object|null
actually
@stof Session wise it depends on whether you do or do not use the |
I also agree with the objection
@fabpot what was your main argument/idea for the change? |
@Tobion I'm not convinced myself that this is a good idea. Closing now. |
I propose to deprecate the
app
global variable and replace it with Twig functions:app.request
->request()
app.session
->session()
app.user
->user()
app.environment
->env()
app.debug
->is_debug()