class ApplicationTrait extends Application

TODO PHP5.4以上の対応でよくなったら消す

Methods

FormBuilder
form(mixed $data = null, array $options = array())

Creates and returns a form builder instance

bool
log(string $message, array $context = array(), int $level = Logger::INFO)

Adds a log record.

mixed
user()

Gets a user from the Security Context.

string
encodePassword(UserInterface $user, string $password)

Encodes the raw password.

int
mail(Swift_Message $message, array $failedRecipients = null)

Sends an email.

string
trans(string $id, array $parameters = array(), string $domain = 'messages', string $locale = null)

Translates the given message.

string
transChoice(string $id, int $number, array $parameters = array(), string $domain = 'messages', string $locale = null)

Translates the given choice message by choosing a translation according to a number.

Response
render(string $view, array $parameters = array(), Response $response = null)

Renders a view and returns a Response.

Response
renderView(string $view, array $parameters = array())

Renders a view.

string
path(string $route, mixed $parameters = array())

Generates a path from the given parameters.

string
url(string $route, mixed $parameters = array())

Generates an absolute URL from the given parameters.

Details

at line 36
FormBuilder form(mixed $data = null, array $options = array())

Creates and returns a form builder instance

Parameters

mixed $data The initial data for the form
array $options Options for the form

Return Value

FormBuilder

at line 51
bool log(string $message, array $context = array(), int $level = Logger::INFO)

Adds a log record.

Parameters

string $message The log message
array $context The log context
int $level The logging level

Return Value

bool Whether the record has been processed

at line 64
mixed user()

Gets a user from the Security Context.

Return Value

mixed

See also

TokenInterface::getUser()

at line 87
string encodePassword(UserInterface $user, string $password)

Encodes the raw password.

Parameters

UserInterface $user A UserInterface instance
string $password The password to encode

Return Value

string The encoded password

Exceptions

RuntimeException when no password encoder could be found for the user

at line 101
int mail(Swift_Message $message, array $failedRecipients = null)

Sends an email.

Parameters

Swift_Message $message A \Swift_Message instance
array $failedRecipients An array of failures by-reference

Return Value

int The number of sent messages

at line 117
string trans(string $id, array $parameters = array(), string $domain = 'messages', string $locale = null)

Translates the given message.

Parameters

string $id The message id
array $parameters An array of parameters for the message
string $domain The domain for the message
string $locale The locale

Return Value

string The translated string

at line 133
string transChoice(string $id, int $number, array $parameters = array(), string $domain = 'messages', string $locale = null)

Translates the given choice message by choosing a translation according to a number.

Parameters

string $id The message id
int $number The number to use to find the indice of the message
array $parameters An array of parameters for the message
string $domain The domain for the message
string $locale The locale

Return Value

string The translated string

at line 150
Response render(string $view, array $parameters = array(), Response $response = null)

Renders a view and returns a Response.

To stream a view, pass an instance of StreamedResponse as a third argument.

Parameters

string $view The view name
array $parameters An array of parameters to pass to the view
Response $response A Response instance

Return Value

Response A Response instance

at line 176
Response renderView(string $view, array $parameters = array())

Renders a view.

Parameters

string $view The view name
array $parameters An array of parameters to pass to the view

Return Value

Response A Response instance

at line 190
string path(string $route, mixed $parameters = array())

Generates a path from the given parameters.

Parameters

string $route The name of the route
mixed $parameters An array of parameters

Return Value

string The generated path

at line 203
string url(string $route, mixed $parameters = array())

Generates an absolute URL from the given parameters.

Parameters

string $route The name of the route
mixed $parameters An array of parameters

Return Value

string The generated URL