W3cubDocs

/Symfony 2.8

Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables

class GlobalVariables

GlobalVariables is the entry point for Symfony global variables in PHP templates.

Methods

__construct(ContainerInterface $container)
SecurityContext|null getSecurity()

Returns the security context service.

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

public __construct(ContainerInterface $container)

Parameters

ContainerInterface $container The DI container

public SecurityContext|null getSecurity()

Returns the security context service.

Return Value

SecurityContext|null The security context

public mixed getUser()

Returns the current user.

Return Value

mixed

See also

TokenInterface::getUser()

public Request|null getRequest()

Returns the current request.

Return Value

Request|null The HTTP request object

public Session|null getSession()

Returns the current session.

Return Value

Session|null The session

public string getEnvironment()

Returns the current app environment.

Return Value

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

public bool getDebug()

Returns the current app debug mode.

Return Value

bool The current debug mode

© 2004–2016 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/2.8/Symfony/Bundle/FrameworkBundle/Templating/GlobalVariables.html