Symfony2 にあるフォームの EWZ recaptcha フィールドの検証に問題があります。
ここに私のCaptchaエンティティがあります:
<?php
namespace Acme\FormBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints as Recaptcha;
/**
 * Captcha
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class Captcha
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
    /**
     * @var boolean
     *
     * @ORM\Column(name="captcha", type="boolean")
     */
    private $captcha;
    /**
     * @var integer
     *
     * @ORM\Column(name="uniqueid", type="integer")
     */
    private $uniqueid;
    /**
     * @Recaptcha\True
     */
    public $recaptcha;
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set captcha
     *
     * @param boolean $captcha
     * @return Captcha
     */
    public function setCaptcha($captcha)
    {
        $this->captcha = $captcha;
        return $this;
    }
    /**
     * Get captcha
     *
     * @return boolean 
     */
    public function getCaptcha()
    {
        return $this->captcha;
    }
    /**
     * Set uniqueid
     *
     * @param integer $uniqueid
     * @return Captcha
     */
    public function setUniqueid($uniqueid)
    {
        $this->uniqueid = $uniqueid;
        return $this;
    }
    /**
     * Get uniqueid
     *
     * @return integer 
     */
    public function getUniqueid()
    {
        return $this->uniqueid;
    }
}
ここに私のフォームがあります:
<?php
namespace Acme\FormBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\True;
class CaptchaType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('recaptcha', 'ewz_recaptcha')
        ;
    }
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Acme\FormBundle\Entity\Captcha'
        ));
    }
    public function getName()
    {
        return 'captchaType';
    }
}
これが私のコントローラーです:
<?php
namespace Acme\FormBundle\Controller;
use Acme\FormBundle\Entity\User;
use Acme\FormBundle\Entity\Workstation;
use Acme\FormBundle\Entity\Captcha;
use Acme\FormBundle\Form\CaptchaType;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\True;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormBuilderInterface;
class DefaultController extends Controller
{
    public function indexAction(Request $request)
    {
        $captcha = new Captcha();
        $form = $this->createForm(new CaptchaType(), $captcha);
        if ($request->isMethod('POST')) {
            echo "1";
            $form->bind($request);
            echo "2";
            if ($form->isValid()) {
                echo "3A";
                // perform some action, such as saving the task to the database
                $session = $this->getRequest()->getSession();
                $temptime = strtotime("now");
                $session->set('uniqueid', $temptime);
                return $this->redirect($this->generateUrl('customer_info'));
            }else{
                return $this->redirect($this->generateUrl('captcha'));
            }
            echo "3B";
        }
        return $this->render('AcmeFormBundle:Default:index.html.twig', array('form' => $form->createView()));
    }
フォームが有効かどうかを確認すると、true にはなりません。私はかなり簡単なことを見逃していると確信していますが、過去4時間これを理解しようとしていて、行き詰まっています.
どんな助けでも大歓迎です。
ありがとう