From 2b8c7f84b502007e2d4c8b1e62254492f88badcd Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Apr 2011 09:28:29 +0200 Subject: [PATCH] [Form] added a way to register a Form extension after creation of the FormFactory --- src/Symfony/Component/Form/FormFactory.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Form/FormFactory.php b/src/Symfony/Component/Form/FormFactory.php index 66d219caa0..17584f00bf 100644 --- a/src/Symfony/Component/Form/FormFactory.php +++ b/src/Symfony/Component/Form/FormFactory.php @@ -14,7 +14,6 @@ namespace Symfony\Component\Form; use Symfony\Component\Form\Guess\TypeGuesserInterface; use Symfony\Component\Form\Guess\Guess; use Symfony\Component\Form\Exception\FormException; -use Symfony\Component\Form\Exception\UnexpectedTypeException; class FormFactory implements FormFactoryInterface { @@ -24,15 +23,16 @@ class FormFactory implements FormFactoryInterface private $guesser; - public function __construct(array $extensions) + public function __construct(array $extensions = array()) { foreach ($extensions as $extension) { - if (!$extension instanceof FormExtensionInterface) { - throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormExtensionInterface'); - } + $this->addExtension($extension); } + } - $this->extensions = $extensions; + public function addExtension(FormExtensionInterface $extension) + { + $this->extensions[] = $extension; } private function loadGuesser()