8000 [Validator] removed deprecated features in Validator and Form by fabpot · Pull Request #16024 · symfony/symfony · GitHub
[go: up one dir, main page]

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 1 commit
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
Prev Previous commit
Next Next commit
[Form] removed deprecated FormType::getName()
  • Loading branch information
fabpot committed Oct 1, 2015
commit 582f3a39b73857b0b9f5e5641a00a2f01a39c579
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
14 changes: 2 additions & 12 deletions src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)

$blockPrefixes = array();
for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
if (method_exists($type, 'getBlockPrefix')) {
array_unshift($blockPrefixes, $type->getBlockPrefix());
} else {
@trigger_error(get_class($type).': The ResolvedFormTypeInterface::getBlockPrefix() method will be added in version 3.0. You should add it to your implementation.', E_USER_DEPRECATED);

$fqcn = get_class($type->getInnerType());
$name = $type->getName();
$hasCustomName = $name !== $fqcn;

array_unshift($blockPrefixes, $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn));
}
array_unshift($blockPrefixes, $type->getBlockPrefix());
}
$blockPrefixes[] = $uniqueBlockPrefix;

Expand All @@ -111,7 +101,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
// collection form have different types (dynamically), they should
// be rendered differently.
// https://github.com/symfony/symfony/issues/5038
'cache_key' => $uniqueBlockPrefix.'_'.$form->getConfig()->getType()->getName(),
'cache_key' => $uniqueBlockPrefix.'_'.$form->getConfig()->getType()->getBlockPrefix(),
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ public function getParent()
return __NAMESPACE__.'\DateType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ public function getParent()
{
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ public function configureOptions(OptionsResolver $resolver)
));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setAllowedTypes('group_by', array('null', 'array', '\Traversable', 'string', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath'));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setNormalizer('options', $optionsNormalizer);
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ public function getParent()
return __NAMESPACE__.'\ChoiceType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ public function getParent()
return __NAMESPACE__.'\ChoiceType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,6 @@ public function configureOptions(OptionsResolver $resolver)
));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setAllowedTypes('days', 'array');
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/EmailType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ public function getParent()
return __NAMESPACE__.'\TextType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/FileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ public function configureOptions(OptionsResolver $resolver)
));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/FormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,6 @@ public function getParent()
{
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ public function configureOptions(OptionsResolver $resolver)
));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setAllowedTypes('scale', array('null', 'int'));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ public function getParent()
return __NAMESPACE__.'\ChoiceType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ public function getParent()
return __NAMESPACE__.'\ChoiceType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setAllowedTypes('scale', 'int');
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setAllowedTypes('scale', array('null', 'int'));
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ public function getParent()
return __NAMESPACE__.'\TextType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setAllowedTypes('scale', 'int');
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
8 changes: 0 additions & 8 deletions src/Symfony/Component/Form/Extension/Core/Type/RadioType.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ public function getParent()
return __NAMESPACE__.'\CheckboxType';
}

/**
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
Expand Down
Loading
0