8000 [Form] Fix BC break introduced in #14050 · symfony/symfony@f3dbb5d · GitHub
[go: up one dir, main page]

Skip to content

Commit f3dbb5d

Browse files
[Form] Fix BC break introduced in #14050
1 parent 607dedd commit f3dbb5d

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

src/Symfony/Bridge/Twig/Extension/FormExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser;
1515
use Symfony\Bridge\Twig\Form\TwigRendererInterface;
16-
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
16+
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
1717

1818
/**
1919
* FormExtension extends Twig with form capabilities.

src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212
namespace Symfony\Component\Form\ChoiceList\View;
1313

14+
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;
15+
1416
/**
1517
* Represents a choice in templates.
1618
*
1719
* @author Bernhard Schussek <bschussek@gmail.com>
1820
*/
19-
class ChoiceView
21+
class ChoiceView extends LegacyChoiceView
2022
{
2123
/**
2224
* The label displayed to humans.

src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php

Lines changed: 26 additions & 5 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,37 @@
1111

1212
namespace Symfony\Component\Form\Extension\Core\View;
1313

14-
use Symfony\Component\Form\ChoiceList\View\ChoiceView as BaseChoiceView;
15-
1614
/**
1715
* Represents a choice in templates.
1816
*
1917
* @author Bernhard Schussek <bschussek@gmail.com>
2018
*
2119
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
22-
* Use {@link BaseChoiceView} instead.
20+
* Use {@link \Symfony\Component\Form\ChoiceList\View\ChoiceView} instead.
2321
*/
24-
class ChoiceView extends BaseChoiceView
22+
class ChoiceView
2523
{
24+
/**
25+
* The original choice value.
26+
*
27+
* @var mixed
28+
*/
29+
public $data;
30+
31+
/**
32+
* The view representation of the choice.
33+
*
34+
* @var string
35+
*/
36+
public $value;
37+
38+
/**
39+
* The label displayed to humans.
40+
*
41+
* @var string
42+
*/
43+
public $label;
44+
2645
/**
2746
* Creates a new ChoiceView.
2847
*
@@ -32,7 +51,9 @@ class ChoiceView extends BaseChoiceView
3251
*/
3352
public function __construct($data, $value, $label)
3453
{
35-
parent::__construct($label, $value, $data);
54+
$this->data = $data;
55+
$this->value = $value;
56+
$this->label = $label;
3657

3758
trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\Form\ChoiceList\View\ChoiceView instead.', E_USER_DEPRECATED);
3859
}

0 commit comments

Comments
 (0)
0