Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "[Form] added a circular reference safeguard for form type"

This reverts commit ea93e4c.

Conflicts:

	src/Symfony/Component/Form/FormBuilder.php
	src/Symfony/Component/Form/FormFactory.php
  • Loading branch information...
commit cf2061c7575e8c54ab137bd3238819249fa32ab1 1 parent b7357ef
@webmozart webmozart authored
View
22 Exception/CircularReferenceException.php
@@ -1,22 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * 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);
- }
-}
View
12 FormBuilder.php
@@ -13,7 +13,6 @@
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 @@ public function add($child, $type = null, array $options = array())
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 @@ public function getForm()
return $form;
}
- public function setCurrentLoadingType($type)
- {
- $this->currentLoadingType = $type;
- }
-
/**
* {@inheritdoc}
*/
View
2  FormFactory.php
@@ -217,7 +217,6 @@ public function createNamedBuilder($name, $type, $data = null, array $options =
}
$builder->setTypes($types);
- $builder->setCurrentLoadingType($type->getName());
$builder->setParent($parent);
foreach ($types as $type) {
@@ -227,7 +226,6 @@ public function createNamedBuilder($name, $type, $data = null, array $options =
$typeExtension->buildForm($builder, $options);
}
}
- $builder->setCurrentLoadingType(null);
return $builder;
}
Please sign in to comment.
Something went wrong with that request. Please try again.