In my Symfony3 application, I want to create a check constraint where the maximum length value can be set dynamically through a parameter file, something like this
app/paramters.yml :
parameters: ... entity_max_length: 5
File src/Acme/MyBundle/Resources/config/validation.yml :
Acme\MyBundle\Entity\MyEntity properties: name: - Length: max: '%entity_max_length%'
But that will not work. It simply marks all elements as too long and gives an error message, for example
Your field is too long. The limit is% entity_max_length% characters.
Is there a way to pass parameters to validation restrictions in YAML?
source share