class AppVariable

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

Methods

setTokenStorage(TokenStorageInterface $tokenStorage)

No description

setRequestStack(RequestStack $requestStack)

No description

setEnvironment($environment)

No description

setDebug($debug)

No description

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.

Details

at line line 32
setTokenStorage(TokenStorageInterface $tokenStorage)

Parameters

TokenStorageInterface $tokenStorage

at line line 37
setRequestStack(RequestStack $requestStack)

Parameters

RequestStack $requestStack

at line line 42
setEnvironment($environment)

Parameters

$environment

at line line 47
setDebug($debug)

Parameters

$debug

at line line 59
TokenInterface|null getToken()

Returns the current token.

Return Value

TokenInterface|null

Exceptions

RuntimeException When the TokenStorage is not available

at line line 75
mixed getUser()

Returns the current user.

Return Value

mixed

See also

TokenInterface::getUser()

at line line 96
Request|null getRequest()

Returns the current request.

Return Value

Request|null The HTTP request object

at line line 110
Session|null getSession()

Returns the current session.

Return Value

Session|null The session

at line line 126
string getEnvironment()

Returns the current app environment.

Return Value

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

at line line 140
bool getDebug()

Returns the current app debug mode.

Return Value

bool The current debug mode

at line line 157
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.

Parameters

$types

Return Value

array