class AppVariable
Exposes some Symfony parameters and services as an "app" global variable.
| setTokenStorage(TokenStorageInterface $tokenStorage) | ||
| setRequestStack(RequestStack $requestStack) | ||
| setEnvironment($environment) | ||
| setDebug($debug) | ||
| TokenInterface|null | getToken() Returns the current token. | |
| mixed | getUser() Returns the current user. | |
| Request|null | getRequest() Returns the current request. | |
| Session|null | getSession() Returns the current session. | |
| string | getEnvironment() Returns the current app environment. | |
| bool | getDebug() Returns the current app debug mode. | |
| array | getFlashes($types = null) Returns some or all the existing flash messages: * getFlashes() returns all the flash messages * getFlashes('notice') returns a simple array with flash messages of that type * getFlashes(array('notice', 'error')) returns a nested array of type => messages. |
| TokenStorageInterface | $tokenStorage |
| RequestStack | $requestStack |
| $environment |
| $debug |
Returns the current token.
| TokenInterface|null |
| RuntimeException | When the TokenStorage is not available |
Returns the current user.
| mixed |
| TokenInterface::getUser |
Returns the current request.
| Request|null | The HTTP request object |
Returns the current session.
| Session|null | The session |
Returns the current app environment.
| string | The current environment string (e.g 'dev') |
Returns the current app debug mode.
| bool | The current debug mode |
Returns some or all the existing flash messages: * getFlashes() returns all the flash messages * getFlashes('notice') returns a simple array with flash messages of that type * getFlashes(array('notice', 'error')) returns a nested array of type => messages.
| $types |
| array |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bridge/Twig/AppVariable.html