2
私のアプリではsymfony-2.8をsymfony-captcha-bundleとともに使用しています。私のユーザーエンティティは登録プロセス中にcaptcha検証を行い、期待どおりに動作します。 私はユーザーオブジェクトの更新を行った後、アプリがエラーを返した場合:特定のアクション/コンテキスト(登録および更新なし)に対してのみ、検証制約(Captcha Assert)の使用を制限する方法
request.CRITICAL: Uncaught PHP Exception
Symfony\Component\Debug\Exception\ContextErrorException: "Catchable Fatal Error:
Argument 1 passed to Captcha\Bundle\CaptchaBundle\Helpers\BotDetectCaptchaHelper::__construct() must implement interface
Symfony\Component\HttpFoundation\Session\SessionInterface, null given, called in C:\apps\Apache24\htdocs\WodProject\vendor\captcha-com\symfony-captcha-bundle\Integration\BotDetectCaptcha.php
on line 68 and defined" at C:\apps\Apache24\htdocs\WodProject\vendor\captcha-com\symfony-captcha-bundle\Helpers\BotDetectCaptchaHelper.php
line 26 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0):
Catchable Fatal Error: Argument 1 passed to Captcha\\Bundle\\CaptchaBundle\\Helpers\\BotDetectCaptchaHelper::__construct()
must implement interface Symfony\\Component\\HttpFoundation\\Session\\SessionInterface, null given, called in C:\\apps\\Apache24\\htdocs\\WodProject\\vendor\\captcha-com\\symfony-captcha-bundle\\Integration\\BotDetectCaptcha.php
on line 68 and defined at C:\\apps\\Apache24\\htdocs\\WodProject\\vendor\\captcha-com\\symfony-captcha-bundle\\Helpers\\BotDetectCaptchaHelper.php:26)"} []
キャプチャの検証をユーザエンティティへ:
/**
* @CaptchaAssert\ValidCaptcha(
* message = "registration.errorCatpcha"
*)
*/
protected $captchaCode;
私はこの問題は、制約が常にトリガされていることだと思い。私はどのようにユーザーの登録中に制約をアクティブにし、他のアクション(更新など)で無効にするかを知る必要があります。
パーフェクト!できます! – Frodogus