[Form] Fixed the deprecation notes for the "virtual" option
This commit is contained in:
parent
ac2ca44b5a
commit
1290b804e0
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Symfony\Component\Form\Util;
|
|||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
|
Reference in New Issue