minor #14223 [Form] Fix BC break introduced in #14050 (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Fix BC break introduced in #14050

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

f3dbb5d [Form] Fix BC break introduced in #14050
This commit is contained in:
Nicolas Grekas 2015-04-05 20:44:45 +02:00
commit d1be9d04d7
3 changed files with 30 additions and 7 deletions

View File

@ -13,7 +13,7 @@ namespace Symfony\Bridge\Twig\Extension;
use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser;
use Symfony\Bridge\Twig\Form\TwigRendererInterface;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
/**
* FormExtension extends Twig with form capabilities.

View File

@ -11,12 +11,14 @@
namespace Symfony\Component\Form\ChoiceList\View;
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;
/**
* Represents a choice in templates.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class ChoiceView
class ChoiceView extends LegacyChoiceView
{
/**
* The label displayed to humans.

View File

@ -11,18 +11,37 @@
namespace Symfony\Component\Form\Extension\Core\View;
use Symfony\Component\Form\ChoiceList\View\ChoiceView as BaseChoiceView;
/**
* Represents a choice in templates.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated Deprecated since Symfony 2.7, to be removed in Symfony 3.0.
* Use {@link BaseChoiceView} instead.
* Use {@link \Symfony\Component\Form\ChoiceList\View\ChoiceView} instead.
*/
class ChoiceView extends BaseChoiceView
class ChoiceView
{
/**
* The original choice value.
*
* @var mixed
*/
public $data;
/**
* The view representation of the choice.
*
* @var string
*/
public $value;
/**
* The label displayed to humans.
*
* @var string
*/
public $label;
/**
* Creates a new ChoiceView.
*
@ -32,7 +51,9 @@ class ChoiceView extends BaseChoiceView
*/
public function __construct($data, $value, $label)
{
parent::__construct($label, $value, $data);
$this->data = $data;
$this->value = $value;
$this->label = $label;
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);
}