I tried to use parameters in annotations, but it didn't work
e.g. in object constraints:
...
use Symfony\Component\Validator\Constraints as Assert;
class SomeObj {
/**
* @Assert\File(maxSize="%max_filesize%")
*/
private $file;
...
}
in parameters.yml
parameters:
...
max_filesize: 5M
I got ConstraintDefinitionException('"%max_filesize%" is not a valid maximum size')
.
I believe I have to drop using annotation format and try some other (YAML?). Or extend FileConstraint with new class and somehow set $maxFilesize there from parameters. What'are the other solutions to this problem and which one is the best?