Ciao,
ritorno sull'argomento, ho installato il
https://github.com/Bee-Lab/BeelabRecaptcha2Bundleseguendo la documentazione per la configurazione
ho aggiunto il bundle nel kernel
ho aggiunto
beelab_recaptcha2:
site_key: "%recaptcha_site_key%"
secret: "%recaptcha_secret%"
nel config.yml definendo i parametri sopra citati nel parameters.yml con quelli forniti da google
ho aggiunto nel form di registrazione
->add('captcha', RecaptchaType::class, [
'constraints' => new Recaptcha2(['groups' => ['create']]), // "groups" option is not mandatory
])
e ho aggiunto
<script src="//www.google.com/recaptcha/api.js?hl={{ app.request.locale }}"></script>
nel twig di registrazione.
Solo che nel momento in cui provo ad accedere alla pagina di registrazione (stiamo parlando di produzione) prendo l'errore:
[2017-04-10 12:00:15] request.CRITICAL: Uncaught PHP Exception Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException: "Neither the property "captcha" nor one of the methods "getCaptcha()", "captcha()", "isCaptcha()", "hasCaptcha()", "__get()" exist and have public access in class "AppBundle\Entity\User"." at /var/www/vhosts/pincopallino.com/httpdocs/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php line 486 {"exception":"[object] (Symfony\\Component\\PropertyAccess\\Exception\\NoSuchPropertyException(code: 0): Neither the property \"captcha\" nor one of the methods \"getCaptcha()\", \"captcha()\", \"isCaptcha()\", \"hasCaptcha()\", \"__get()\" exist and have public access in class \"AppBundle\\Entity\\User\". at /var/www/vhosts/pincopallino.com/httpdocs/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php:486)"} []
Devo aggiungere il captcha come proprietà dell'entity user? Dalla doc non sembrava sottinteso, se si in che modo la devo aggiungere??
Grazie