From 7f30646c68d821fbd1105a94c8365b0a4396e4f0 Mon Sep 17 00:00:00 2001 From: Gregwar Date: Wed, 7 Aug 2013 10:56:49 +0200 Subject: [PATCH] Moving the "reload without as_url" exception to catch more cases (see --- DependencyInjection/GregwarCaptchaExtension.php | 4 ---- Type/CaptchaType.php | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DependencyInjection/GregwarCaptchaExtension.php b/DependencyInjection/GregwarCaptchaExtension.php index 75b7246..83f4ddb 100755 --- a/DependencyInjection/GregwarCaptchaExtension.php +++ b/DependencyInjection/GregwarCaptchaExtension.php @@ -33,10 +33,6 @@ class GregwarCaptchaExtension extends Extension $container->setParameter('gregwar_captcha.config.expiration', $config['expiration']); $container->setParameter('gregwar_captcha.config.whitelist_key', $config['whitelist_key']); - if ($config['reload'] && !$config['as_url']) { - throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information'); - } - $resources = $container->getParameter('twig.form.resources'); $container->setParameter('twig.form.resources', array_merge(array('GregwarCaptchaBundle::captcha.html.twig'), $resources)); } diff --git a/Type/CaptchaType.php b/Type/CaptchaType.php index 2a90ed7..2b10374 100644 --- a/Type/CaptchaType.php +++ b/Type/CaptchaType.php @@ -90,6 +90,10 @@ class CaptchaType extends AbstractType { $isHuman = false; + if ($options['reload'] && !$options['as_url']) { + throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information'); + } + if ($options['humanity'] > 0) { $humanityKey = $this->key.'_humanity'; if ($this->session->get($humanityKey, 0) > 0) {