How can I pass symfony2 callback validator a parameter? I need to pass it a value from parameters ini.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This link Symfony2 – How to use Entity variables in CallbackValidator? directly address your question. Basically the ‘use’ directive can pass variables:
However, when passing multiple arguments, I find it easier to just make a validator class that implements FormValidatorInterface and use it:
I’ll even make it a service so I don’t have to worry about constructing it.