diff --git a/src/Symfony/Component/Form/Exception/CircularReferenceException.php b/src/Symfony/Component/Form/Exception/CircularReferenceException.php deleted file mode 100644 index 629044965e..0000000000 --- a/src/Symfony/Component/Form/Exception/CircularReferenceException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Exception; - -use Symfony\Component\Form\FormTypeInterface; - -class CircularReferenceException extends FormException -{ - public function __construct(FormTypeInterface $type, $code = 0, $previous = null) - { - parent::__construct(sprintf('Circular reference detected in the "%s" type (defined in class "%s").', $type->getName(), get_class($type)), $code, $previous); - } -} diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 8a33cd5869..51fc2cbe9d 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\UnexpectedTypeException; -use Symfony\Component\Form\Exception\CircularReferenceException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** @@ -44,8 +43,6 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI */ private $unresolvedChildren = array(); - private $currentLoadingType; - /** * The parent of this builder * @var FormBuilder @@ -98,10 +95,6 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); } - if ($this->currentLoadingType && ($type instanceof FormTypeInterface ? $type->getName() : $type) == $this->currentLoadingType) { - throw new CircularReferenceException(is_string($type) ? $this->getFormFactory()->getType($type) : $type); - } - // Add to "children" to maintain order $this->children[$child] = null; $this->unresolvedChildren[$child] = array( @@ -211,11 +204,6 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI return $form; } - public function setCurrentLoadingType($type) - { - $this->currentLoadingType = $type; - } - /** * {@inheritdoc} */ diff --git a/src/Symfony/Component/Form/FormFactory.php b/src/Symfony/Component/Form/FormFactory.php index 5537b32192..046804f039 100644 --- a/src/Symfony/Component/Form/FormFactory.php +++ b/src/Symfony/Component/Form/FormFactory.php @@ -217,7 +217,6 @@ class FormFactory implements FormFactoryInterface } $builder->setTypes($types); - $builder->setCurrentLoadingType($type->getName()); $builder->setParent($parent); foreach ($types as $type) { @@ -227,7 +226,6 @@ class FormFactory implements FormFactoryInterface $typeExtension->buildForm($builder, $options); } } - $builder->setCurrentLoadingType(null); return $builder; }