diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
index 8bef4bc28e7a..82fd29adc3c2 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
@@ -18,6 +18,7 @@
@@ -32,20 +33,11 @@
-
+
-
+
-
+
@@ -138,6 +130,11 @@
+
+
+
+
+
diff --git a/src/Symfony/Component/Form/Extension/Core/CoreExtension.php b/src/Symfony/Component/Form/Extension/Core/CoreExtension.php
index e57a5b268510..f0f0d181da98 100644
--- a/src/Symfony/Component/Form/Extension/Core/CoreExtension.php
+++ b/src/Symfony/Component/Form/Extension/Core/CoreExtension.php
@@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Extension\Core;
-use Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\AbstractExtension;
/**
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
index 565053791779..9dfa8af2717c 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
@@ -17,7 +17,6 @@
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormView;
-use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener;
use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\Form\Exception\FormException;
@@ -45,7 +44,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->setData(isset($options['data']) ? $options['data'] : null)
->setDataLocked(isset($options['data']))
->setDataMapper($options['compound'] ? new PropertyPathMapper() : null)
- ->addEventSubscriber(new BindRequestListener())
;
if ($options['trim']) {
diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php b/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php
similarity index 97%
rename from src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php
rename to src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php
index 868a5ae42f44..1c019fc9763a 100644
--- a/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php
+++ b/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Form\Extension\Core\EventListener;
+namespace Symfony\Component\Form\Extension\HttpFoundation\EventListener;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php b/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php
new file mode 100644
index 000000000000..3c440a671460
--- /dev/null
+++ b/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php
@@ -0,0 +1,29 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Extension\HttpFoundation;
+
+use Symfony\Component\Form\AbstractExtension;
+
+/**
+ * Integrates the HttpFoundation component with the Form library.
+ *
+ * @author Bernhard Schussek
+ */
+class HttpFoundationExtension extends AbstractExtension
+{
+ protected function loadTypes()
+ {
+ return array(
+ new Type\FormTypeHttpFoundationExtension(),
+ );
+ }
+}
diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
new file mode 100644
index 000000000000..27a1831fd663
--- /dev/null
+++ b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
@@ -0,0 +1,50 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Extension\HttpFoundation\Type;
+
+use Symfony\Component\Form\AbstractTypeExtension;
+use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\Options;
+use Symfony\Component\OptionsResolver\OptionsResolverInterface;
+
+/**
+ * @author Bernhard Schussek
+ */
+class FormTypeHttpFoundationExtension extends AbstractTypeExtension
+{
+ /**
+ * @var BindRequestListener
+ */
+ private $listener;
+
+ public function __construct()
+ {
+ $this->listener = new BindRequestListener();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function buildForm(FormBuilderInterface $builder, array $options)
+ {
+ $builder->addEventSubscriber($this->listener);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getExtendedType()
+ {
+ return 'form';
+ }
+}
diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
index 4e591858da9f..122a44af88d0 100644
--- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php
+++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -14,7 +14,7 @@
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormError;
-use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener;
+use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\EventDispatcher\EventDispatcher;
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
similarity index 98%
rename from src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php
rename to src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
index bc076582253e..bfb9afa0a790 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
@@ -9,9 +9,9 @@
* file that was distributed with this source code.
*/
-namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
+namespace Symfony\Component\Form\Tests\Extension\HttpFoundation\EventListener;
-use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener;
+use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormConfigBuilder;
use Symfony\Component\Form\FormEvent;