diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index 9fdeaffcdd..25fdc6d8f0 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -9,7 +9,7 @@ CHANGELOG * added FormProcessorInterface and FormInterface::process() * deprecated passing a Request instance to FormInterface::bind() * added options "method" and "action" to FormType - * deprecated option "virtual", renamed it to "inherit_data" + * deprecated option "virtual" in favor "inherit_data" * deprecated VirtualFormAwareIterator in favor of InheritDataAwareIterator * [BC BREAK] removed the "array" type hint from DataMapperInterface * improved forms inheriting their parent data to actually return that data from getData(), getNormData() and getViewData() diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index 31835357c1..473b009ea3 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -150,6 +150,18 @@ class FormType extends BaseType return $options['compound']; }; + // BC with old "virtual" option + $inheritData = function (Options $options) { + if (null !== $options['virtual']) { + // Uncomment this as soon as the deprecation note should be shown + // trigger_error('The form option "virtual" is deprecated since version 2.3 and will be removed in 3.0. Use "inherit_data" instead.', E_USER_DEPRECATED); + + return $options['virtual']; + } + + return false; + }; + // If data is given, the form is locked to that data // (independent of its value) $resolver->setOptional(array( @@ -169,7 +181,8 @@ class FormType extends BaseType 'by_reference' => true, 'error_bubbling' => $errorBubbling, 'label_attr' => array(), - 'inherit_data' => false, + 'virtual' => null, + 'inherit_data' => $inheritData, 'compound' => true, 'method' => 'POST', // According to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt) diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index 26cea6b7f4..0927c72921 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -351,12 +351,13 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * - * @deprecated Deprecated since version 2.2, to be removed in 2.3. Use + * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use * {@link getInheritData()} instead. */ public function getVirtual() { - trigger_error('getVirtual() is deprecated since version 2.2 and will be removed in 2.3. Use getInheritData() instead.', E_USER_DEPRECATED); + // Uncomment this as soon as the deprecation note should be shown + // trigger_error('getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use getInheritData() instead.', E_USER_DEPRECATED); return $this->getInheritData(); } @@ -709,12 +710,13 @@ class FormConfigBuilder implements FormConfigBuilderInterface * * @return FormConfigBuilder The configuration object. * - * @deprecated Deprecated since version 2.2, to be removed in 2.3. Use + * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use * {@link setInheritData()} instead. */ public function setVirtual($inheritData) { - trigger_error('setVirtual() is deprecated since version 2.2 and will be removed in 2.3. Use setInheritData() instead.', E_USER_DEPRECATED); + // Uncomment this as soon as the deprecation note should be shown + // trigger_error('setVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use setInheritData() instead.', E_USER_DEPRECATED); $this->setInheritData($inheritData); } diff --git a/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php b/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php index 55c82ab550..24fdc8bb9f 100644 --- a/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php +++ b/src/Symfony/Component/Form/Util/VirtualFormAwareIterator.php @@ -20,7 +20,7 @@ namespace Symfony\Component\Form\Util; * * @author Bernhard Schussek * - * @deprecated Deprecated since version 2.2, to be removed in 2.3. Use + * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use * {@link InheritDataAwareIterator} instead. */ class VirtualFormAwareIterator extends \ArrayIterator implements \RecursiveIterator @@ -32,7 +32,8 @@ class VirtualFormAwareIterator extends \ArrayIterator implements \RecursiveItera */ public function __construct(array $forms) { - trigger_error('VirtualFormAwareIterator is deprecated since version 2.2 and will be removed in 2.3. Use InheritDataAwareIterator instead.', E_USER_DEPRECATED); + // Uncomment this as soon as the deprecation note should be shown + // trigger_error('VirtualFormAwareIterator is deprecated since version 2.3 and will be removed in 3.0. Use InheritDataAwareIterator instead.', E_USER_DEPRECATED); parent::__construct($forms); }