Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Fix BC break introduced in #14050 #14223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Form] Fix BC break introduced in #14050
  • Loading branch information
nicolas-grekas committed Apr 5, 2015
commit f3dbb5dea20bfc6343a61a47ad4ed01e632b14d5
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bridge/Twig/Extension/FormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

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.
Expand Down
4 changes: 3 additions & 1 deletion 4 src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
31 changes: 26 additions & 5 deletions 31 src/Symfony/Component/Form/Extension/Core/View/ChoiceView.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be triggered only when get_class($this) === __CLASS__

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof no it must not because the new class does not call the parent class at all

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but for people extending the choice view to provide their own implementation, this would still be useful indeed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tobion they would get the deprecation thrown by the DebugClassLoader already

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fixing this issue in #14201.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we worked on the same at the same time :) See #14258 for an alternative

}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.