Trait for controller functionality. Any class that implements this trait
should also implement the interface Autarky\Container\ContainerAwareInterface
- the interface's methods are implemented by the trait, but you still need to
implement the interface on the class.
Methods summary
protected
string
|
#
render( string $name, array $data = array() )
Render a template.
Parameters
- $name
- Name of the view.
- $data
- Data to pass to the view.
Returns
string
|
protected
string
|
#
url( string $name, array $params = array() )
Generate the URL to a route.
Generate the URL to a route.
Parameters
- $name
- Name of the route.
- $params
- Route parameters.
Returns
string
|
protected
Symfony\Component\HttpFoundation\Session\Session
|
#
getSession( )
Get the session manager.
Returns
Symfony\Component\HttpFoundation\Session\Session
|
protected
|
#
flash( string $key, mixed $value )
Flash something to the session.
Flash something to the session.
Parameters
|
protected
|
#
flashMessages( array $messages )
Flash an array of messages to the session.
Flash an array of messages to the session.
Parameters
|
protected
|
#
flashInput( Symfony\Component\HttpFoundation\Request $request = null )
Flash input to session.
Parameters
|
protected
array
|
#
getOldInput( )
Get old input flashed to the session.
Get old input flashed to the session.
Returns
array
|
protected
Symfony\Component\EventDispatcher\EventDispatcherInterface
|
#
getEventDispatcher( )
Get the event dispatcher instance.
Get the event dispatcher instance.
Returns
Symfony\Component\EventDispatcher\EventDispatcherInterface
|
protected
mixed
|
#
dispatchEvent( string $name, Symfony\Component\EventDispatcher\Event $event )
Dispatch an event.
Parameters
Returns
mixed
|
protected
|
#
log( string $level, string $message, array $context = array() )
Log a message.
Parameters
- $level
- https://github.com/php-fig/log/blob/master/Psr/Log/LogLevel.php
- $message
- $context
|
protected
Psr\Log\LoggerInterface
|
#
getLogger( )
Get the logger instance.
Returns
Psr\Log\LoggerInterface
|
protected
Symfony\Component\HttpFoundation\Response
|
#
response( string $content, integer $statusCode = 200 )
Create a response.
Parameters
Returns
Symfony\Component\HttpFoundation\Response
|
protected
Symfony\Component\HttpFoundation\RedirectResponse
|
#
redirect( string $name, array $params = array(), integer $statusCode = 302 )
Create a redirect response.
Create a redirect response.
Parameters
- $name
- Name of the route to redirect to
- $params
- Route parameters
- $statusCode
- Default: 302
Returns
Symfony\Component\HttpFoundation\RedirectResponse
|
protected
Symfony\Component\HttpFoundation\JsonResponse
|
#
json( array $data, integer $statusCode = 200 )
Create a JSON response.
Parameters
Returns
Symfony\Component\HttpFoundation\JsonResponse
|