Skip to content

[Validator] removed deprecated features in Validator and Form #16024

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 7 commits into from
Oct 1, 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
use Symfony\Component\Validator\Validation;
use Doctrine\ORM\Tools\SchemaTool;

/**
Expand All @@ -47,11 +46,6 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
*/
protected $repository;

protected function getApiVersion()
{
return Validation::API_VERSION_2_5;
}

protected function setUp()
{
$this->em = DoctrineTestHelper::createTestEntityManager();
Expand Down
2 changes: 1 addition & 1 deletion 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\Extension\Core\View\ChoiceView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;

/**
* FormExtension extends Twig with form capabilities.
Expand Down
10 changes: 1 addition & 9 deletions src/Symfony/Component/Form/AbstractExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,7 @@ private function initTypes()
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
}

// Since Symfony 3.0 types are identified by their FQCN
$fqcn = get_class($type);
$legacyName = $type->getName();

$this->types[$fqcn] = $type;

if ($legacyName) {
$this->types[$legacyName] = $type;
}
$this->types[get_class($type)] = $type;
}
}

Expand Down
15 changes: 1 addition & 14 deletions src/Symfony/Component/Form/AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ public function configureOptions(OptionsResolver $resolver)
{
}

/**
* {@inheritdoc}
*/
public function getName()
{
// As of Symfony 2.8, the name defaults to the fully-qualified class name
return get_class($this);
}

/**
* Returns the prefix of the template block name for this type.
*
Expand All @@ -66,11 +57,7 @@ public function getName()
*/
public function getBlockPrefix()
{
$fqcn = get_class($this);
$name = $this->getName();

// For BC: Use the name as block prefix if one is set
return $name !== $fqcn ? $name : StringUtil::fqcnToBlockPrefix($fqcn);
return StringUtil::fqcnToBlockPrefix(get_class($this));
}

/**
Expand Down
32 changes: 0 additions & 32 deletions src/Symfony/Component/Form/ButtonBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,6 @@ public function setByReference($byReference)
throw new BadMethodCallException('Buttons do not support data mapping.');
}

/**
* Unsupported method.
*
* This method should not be invoked.
*
* @param bool $virtual
*
* @throws BadMethodCallException
*
* @deprecated since version 2.3, to be removed in 3.0. Use
* {@link setInheritData()} instead.
*/
public function setVirtual($virtual)
{
throw new BadMethodCallException('Buttons cannot be virtual.');
}

/**
* Unsupported method.
*
Expand Down Expand Up @@ -587,21 +570,6 @@ public function getByReference()
return false;
}

/**
* Unsupported method.
*
* @return bool Always returns false.
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link getInheritData()} instead.
*/
public function getVirtual()
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Form\FormConfigBuilder::getInheritData method instead.', E_USER_DEPRECATED);

return false;
}

/**
* Unsupported method.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
use Symfony\Component\Form\ChoiceList\LazyChoiceList;
use Symfony\Component\Form\ChoiceList\LegacyChoiceListAdapter;
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;

/**
* Default implementation of {@link ChoiceListFactoryInterface}.
Expand Down Expand Up @@ -65,23 +63,6 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
*/
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null)
{
// Backwards compatibility
if ($list instanceof LegacyChoiceListAdapter && empty($preferredChoices)
&& null === $label && null === $index && null === $groupBy && null === $attr) {
$mapToNonLegacyChoiceView = function (LegacyChoiceView &$choiceView) {
$choiceView = new ChoiceView($choiceView->data, $choiceView->value, $choiceView->label);
};

$adaptedList = $list->getAdaptedList();

$remainingViews = $adaptedList->getRemainingViews();
$preferredViews = $adaptedList->getPreferredViews();
array_walk_recursive($remainingViews, $mapToNonLegacyChoiceView);
array_walk_recursive($preferredViews, $mapToNonLegacyChoiceView);

return new ChoiceListView($remainingViews, $preferredViews);
}

$preferredViews = array();
$otherViews = array();
$choices = $list->getChoices();
Expand Down
144 changes: 0 additions & 144 deletions src/Symfony/Component/Form/ChoiceList/LegacyChoiceListAdapter.php

This file was deleted.

36 changes: 4 additions & 32 deletions src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Form\Extension\Core\View;
namespace Symfony\Component\Form\ChoiceList\View;

/**
* Represents a choice in templates.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.7, to be removed in 3.0.
* Use {@link \Symfony\Component\Form\ChoiceList\View\ChoiceView} instead.
*/
class ChoiceView
{
Expand All @@ -42,32 +39,6 @@ class ChoiceView
*/
public $data;

/**
* Creates a new ChoiceView.
*
* @param mixed $data The original choice.
* @param string $value The view representation of the choice.
* @param string $label The label displayed to humans.
*/
public function __construct($data, $value, $label)
{
$this->data = $data;
$this->value = $value;
$this->label = $label;
}
}

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 extends LegacyChoiceView
{
/**
* Additional attributes for the HTML tag.
*
Expand All @@ -85,8 +56,9 @@ class ChoiceView extends LegacyChoiceView
*/
public function __construct($data, $value, $label, array $attr = array())
{
parent::__construct($data, $value, $label);

$this->data = $data;
$this->value = $value;
$this->label = $label;
$this->attr = $attr;
}
}
30 changes: 0 additions & 30 deletions src/Symfony/Component/Form/Exception/AlreadyBoundException.php

This file was deleted.

Loading