AppVariable

class AppVariable

Exposes some Symfony parameters and services as an "app" global variable.

Methods

setTokenStorage(TokenStorageInterface $tokenStorage)
setRequestStack(RequestStack $requestStack)
setEnvironment($environment)
setDebug($debug)
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.

Details

setTokenStorage(TokenStorageInterface $tokenStorage)

Parameters

TokenStorageInterface $tokenStorage

setRequestStack(RequestStack $requestStack)

Parameters

RequestStack $requestStack

setEnvironment($environment)

Parameters

$environment

setDebug($debug)

Parameters

$debug

mixed getUser()

Returns the current user.

Return Value

mixed

See also

TokenInterface::getUser()

Request|null getRequest()

Returns the current request.

Return Value

Request|null The HTTP request object

Session|null getSession()

Returns the current session.

Return Value

Session|null The session

string getEnvironment()

Returns the current app environment.

Return Value

string The current environment string (e.g 'dev')

bool getDebug()

Returns the current app debug mode.

Return Value

bool The current debug mode

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.0/Symfony/Bridge/Twig/AppVariable.html