Skip to content

Commit

Permalink
Added deprecation note about 'virtual' form option. Issue #12603.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenard Palko authored and fabpot committed Nov 29, 2014
1 parent d277c16 commit 1308310
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/Symfony/Component/Form/ButtonBuilder.php
Expand Up @@ -592,9 +592,14 @@ public function getByReference()
* Unsupported method.
*
* @return bool Always returns false.
*
* @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
* {@link getInheritData()} instead.
*/
public function getVirtual()
{
trigger_error('ButtonBuilder::getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use FormConfigBuilder::getInheritData() instead.', E_USER_DEPRECATED);

return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/Extension/Core/Type/FormType.php
Expand Up @@ -155,8 +155,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
// 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);
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'];
}

Expand Down
7 changes: 3 additions & 4 deletions src/Symfony/Component/Form/FormConfigBuilder.php
Expand Up @@ -356,8 +356,8 @@ public function getInheritData()
*/
public function getVirtual()
{
// 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);
trigger_error('FormConfigBuilder::getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use FormConfigBuilder::getInheritData() instead.', E_USER_DEPRECATED);

return $this->getInheritData();
}

Expand Down Expand Up @@ -722,8 +722,7 @@ public function setInheritData($inheritData)
*/
public function setVirtual($inheritData)
{
// 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);
trigger_error('FormConfigBuilder::setVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use FormConfigBuilder::setInheritData() instead.', E_USER_DEPRECATED);

$this->setInheritData($inheritData);
}
Expand Down

0 comments on commit 1308310

Please sign in to comment.