Skip to content

Commit 1308310

Browse files
Lenard Palkofabpot
authored andcommitted
Added deprecation note about 'virtual' form option. Issue #12603.
1 parent d277c16 commit 1308310

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/Symfony/Component/Form/ButtonBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,9 +592,14 @@ public function getByReference()
592592
* Unsupported method.
593593
*
594594
* @return bool Always returns false.
595+
*
596+
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
597+
* {@link getInheritData()} instead.
595598
*/
596599
public function getVirtual()
597600
{
601+
trigger_error('ButtonBuilder::getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use FormConfigBuilder::getInheritData() instead.', E_USER_DEPRECATED);
602+
598603
return false;
599604
}
600605

src/Symfony/Component/Form/Extension/Core/Type/FormType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
155155
// BC with old "virtual" option
156156
$inheritData = function (Options $options) {
157157
if (null !== $options['virtual']) {
158-
// Uncomment this as soon as the deprecation note should be shown
159-
// 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);
158+
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);
159+
160160
return $options['virtual'];
161161
}
162162

src/Symfony/Component/Form/FormConfigBuilder.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ public function getInheritData()
356356
*/
357357
public function getVirtual()
358358
{
359-
// Uncomment this as soon as the deprecation note should be shown
360-
// trigger_error('getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use getInheritData() instead.', E_USER_DEPRECATED);
359+
trigger_error('FormConfigBuilder::getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use FormConfigBuilder::getInheritData() instead.', E_USER_DEPRECATED);
360+
361361
return $this->getInheritData();
362362
}
363363

@@ -722,8 +722,7 @@ public function setInheritData($inheritData)
722722
*/
723723
public function setVirtual($inheritData)
724724
{
725-
// Uncomment this as soon as the deprecation note should be shown
726-
// trigger_error('setVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use setInheritData() instead.', E_USER_DEPRECATED);
725+
trigger_error('FormConfigBuilder::setVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use FormConfigBuilder::setInheritData() instead.', E_USER_DEPRECATED);
727726

728727
$this->setInheritData($inheritData);
729728
}

0 commit comments

Comments
 (0)