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

setTokenStorage(TokenStorageInterface $tokenStorage)

Parameters

TokenStorageInterface $tokenStorage

setRequestStack(RequestStack $requestStack)

Parameters

RequestStack $requestStack

setEnvironment($environment)

Parameters

$environment

setDebug($debug)

Parameters

$debug

TokenInterface|null getToken()

Returns the current token.

Return Value

TokenInterface|null

Exceptions

RuntimeException When the TokenStorage is not available

mixed getUser()

Returns the current user.

Return Value

mixed

See also

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

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