I am trying to add EWZRecaptcha to my registration form. My registration form creator looks something like this:
public function buildForm(FormBuilder $builder, array $options) { $builder->add('username', 'text') ->add('password') ->add('recaptcha', 'ewz_recaptcha', array('property_path' => false)); } public function getDefaultOptions(array $options) { return array( 'data_class' => 'Acme\MyBundle\Entity\User', ); }
Now, how can I add a Recaptcha Constraint to the captcha field? I tried adding this to validation.yml:
namespaces: RecaptchaBundle: EWZ\Bundle\RecaptchaBundle\Validator\Constraints\ Acme\MyBundle\Entity\User: ... recaptcha: - "RecaptchaBundle:True": ~
But I get the error Property recaptcha does not exists in class Acme\MyBundle\Entity\User .
If I remove array('property_path' => false) from the parameters of the recaptcha field, I get an error:
Neither property "recaptcha" nor method "getRecaptcha()" nor method "isRecaptcha()" exists in class "Acme\MyBundle\Entity\User"
Any idea how to solve it? :)
source share