Revert "[Form] added a way to register a Form extension after creation of the FormFactory"

This reverts commit 2b8c7f84b5.
This commit is contained in:
Fabien Potencier 2011-04-24 21:56:06 +02:00
parent 2f3ddb88ef
commit f251eab92f

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Form;
use Symfony\Component\Form\Guess\TypeGuesserInterface; use Symfony\Component\Form\Guess\TypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess; use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
class FormFactory implements FormFactoryInterface class FormFactory implements FormFactoryInterface
{ {
@ -23,16 +24,15 @@ class FormFactory implements FormFactoryInterface
private $guesser; private $guesser;
public function __construct(array $extensions = array()) public function __construct(array $extensions)
{ {
foreach ($extensions as $extension) { foreach ($extensions as $extension) {
$this->addExtension($extension); if (!$extension instanceof FormExtensionInterface) {
throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormExtensionInterface');
}
} }
}
public function addExtension(FormExtensionInterface $extension) $this->extensions = $extensions;
{
$this->extensions[] = $extension;
} }
private function loadGuesser() private function loadGuesser()