I want to read any parameter settings since file "validation.yml", but when trying to do is not interpreted.
Example:
In PHP would get the parameter "locale" as follows:
$locate = $this->container->getParameter('locale');
When I try to do the same in the file "validation.yml"
# validation.yml
App\LoginBundle\Validations\Login:
properties:
field:
- NotBlank:
message: "%locale%"
The visible result is literally: %locale%
Any idea?
It is currently not possible to include container-parameters in validation messages directly inside a validation-mapping file.
This is due to the fact that the validation class-metadata has no relation to the container-configuration.
Until symfony 2.1
container-parameters couldn't be used in route-definitions either.
The ability to use parameters in your routes was added in Symfony 2.1.
(see: How to use Service Container parameters in your routes)
Maybe try without quotes?
# validation.yml
App\LoginBundle\Validations\Login:
properties:
field:
- NotBlank:
message: %locale%