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

Commit 582f3a3

Browse filesBrowse files
committed
[Form] removed deprecated FormType::getName()
1 parent bfba6ca commit 582f3a3
Copy full SHA for 582f3a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

47 files changed

+14
-489
lines changed

‎src/Symfony/Component/Form/AbstractExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/AbstractExtension.php
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,7 @@ private function initTypes()
156156
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
157157
}
158158

159-
// Since Symfony 3.0 types are identified by their FQCN
160-
$fqcn = get_class($type);
161-
$legacyName = $type->getName();
162-
163-
$this->types[$fqcn] = $type;
164-
165-
if ($legacyName) {
166-
$this->types[$legacyName] = $type;
167-
}
159+
$this->types[get_class($type)] = $type;
168160
}
169161
}
170162

‎src/Symfony/Component/Form/AbstractType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/AbstractType.php
+1-14Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ public function configureOptions(OptionsResolver $resolver)
4747
{
4848
}
4949

50-
/**
51-
* {@inheritdoc}
52-
*/
53-
public function getName()
54-
{
55-
// As of Symfony 2.8, the name defaults to the fully-qualified class name
56-
return get_class($this);
57-
}
58-
5950
/**
6051
* Returns the prefix of the template block name for this type.
6152
*
@@ -66,11 +57,7 @@ public function getName()
6657
*/
6758
public function getBlockPrefix()
6859
{
69-
$fqcn = get_class($this);
70-
$name = $this->getName();
71-
72-
// For BC: Use the name as block prefix if one is set
73-
return $name !== $fqcn ? $name : StringUtil::fqcnToBlockPrefix($fqcn);
60+
return StringUtil::fqcnToBlockPrefix(get_class($this));
7461
}
7562

7663
/**

‎src/Symfony/Component/Form/Extension/Core/Type/BaseType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
+2-12Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
7878

7979
$blockPrefixes = array();
8080
for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
81-
if (method_exists($type, 'getBlockPrefix')) {
82-
array_unshift($blockPrefixes, $type->getBlockPrefix());
83-
} else {
84-
@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);
85-
86-
$fqcn = get_class($type->getInnerType());
87-
$name = $type->getName();
88-
$hasCustomName = $name !== $fqcn;
89-
90-
array_unshift($blockPrefixes, $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn));
91-
}
81+
array_unshift($blockPrefixes, $type->getBlockPrefix());
9282
}
9383
$blockPrefixes[] = $uniqueBlockPrefix;
9484

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

‎src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ public function getParent()
3434
return __NAMESPACE__.'\DateType';
3535
}
3636

37-
/**
38-
* {@inheritdoc}
39-
*/
40-
public function getName()
41-
{
42-
return $this->getBlockPrefix();
43-
}
44-
4537
/**
4638
* {@inheritdoc}
4739
*/

‎src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ public function getParent()
2828
{
2929
}
3030

31-
/**
32-
* {@inheritdoc}
33-
*/
34-
public function getName()
35-
{
36-
return $this->getBlockPrefix();
37-
}
38-
3931
/**
4032
* {@inheritdoc}
4133
*/

‎src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ public function configureOptions(OptionsResolver $resolver)
6262
));
6363
}
6464

65-
/**
66-
* {@inheritdoc}
67-
*/
68-
public function getName()
69-
{
70-
return $this->getBlockPrefix();
71-
}
72-
7365
/**
7466
* {@inheritdoc}
7567
*/

‎src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,6 @@ public function configureOptions(OptionsResolver $resolver)
357357
$resolver->setAllowedTypes('group_by', array('null', 'array', '\Traversable', 'string', 'callable', 'string', 'Symfony\Component\PropertyAccess\PropertyPath'));
358358
}
359359

360-
/**
361-
* {@inheritdoc}
362-
*/
363-
public function getName()
364-
{
365-
return $this->getBlockPrefix();
366-
}
367-
368360
/**
369361
* {@inheritdoc}
370362
*/

‎src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ public function configureOptions(OptionsResolver $resolver)
9696
$resolver->setNormalizer('options', $optionsNormalizer);
9797
}
9898

99-
/**
100-
* {@inheritdoc}
101-
*/
102-
public function getName()
103-
{
104-
return $this->getBlockPrefix();
105-
}
106-
10799
/**
108100
* {@inheritdoc}
109101
*/

‎src/Symfony/Component/Form/Extension/Core/Type/CountryType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CountryType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ public function getParent()
3636
return __NAMESPACE__.'\ChoiceType';
3737
}
3838

39-
/**
40-
* {@inheritdoc}
41-
*/
42-
public function getName()
43-
{
44-
return $this->getBlockPrefix();
45-
}
46-
4739
/**
4840
* {@inheritdoc}
4941
*/

‎src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ public function getParent()
3636
return __NAMESPACE__.'\ChoiceType';
3737
}
3838

39-
/**
40-
* {@inheritdoc}
41-
*/
42-
public function getName()
43-
{
44-
return $this->getBlockPrefix();
45-
}
46-
4739
/**
4840
* {@inheritdoc}
4941
*/

‎src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,6 @@ public function configureOptions(OptionsResolver $resolver)
283283
));
284284
}
285285

286-
/**
287-
* {@inheritdoc}
288-
*/
289-
public function getName()
290-
{
291-
return $this->getBlockPrefix();
292-
}
293-
294286
/**
295287
* {@inheritdoc}
296288
*/

‎src/Symfony/Component/Form/Extension/Core/Type/DateType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/DateType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,6 @@ public function configureOptions(OptionsResolver $resolver)
276276
$resolver->setAllowedTypes('days', 'array');
277277
}
278278

279-
/**
280-
* {@inheritdoc}
281-
*/
282-
public function getName()
283-
{
284-
return $this->getBlockPrefix();
285-
}
286-
287279
/**
288280
* {@inheritdoc}
289281
*/

‎src/Symfony/Component/Form/Extension/Core/Type/EmailType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/EmailType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ public function getParent()
2323
return __NAMESPACE__.'\TextType';
2424
}
2525

26-
/**
27-
* {@inheritdoc}
28-
*/
29-
public function getName()
30-
{
31-
return $this->getBlockPrefix();
32-
}
33-
3426
/**
3527
* {@inheritdoc}
3628
*/

‎src/Symfony/Component/Form/Extension/Core/Type/FileType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/FileType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ public function configureOptions(OptionsResolver $resolver)
5757
));
5858
}
5959

60-
/**
61-
* {@inheritdoc}
62-
*/
63-
public function getName()
64-
{
65-
return $this->getBlockPrefix();
66-
}
67-
6860
/**
6961
* {@inheritdoc}
7062
*/

‎src/Symfony/Component/Form/Extension/Core/Type/FormType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/FormType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,6 @@ public function getParent()
240240
{
241241
}
242242

243-
/**
244-
* {@inheritdoc}
245-
*/
246-
public function getName()
247-
{
248-
return $this->getBlockPrefix();
249-
}
250-
251243
/**
252244
* {@inheritdoc}
253245
*/

‎src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ public function configureOptions(OptionsResolver $resolver)
3030
));
3131
}
3232

33-
/**
34-
* {@inheritdoc}
35-
*/
36-
public function getName()
37-
{
38-
return $this->getBlockPrefix();
39-
}
40-
4133
/**
4234
* {@inheritdoc}
4335
*/

‎src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ public function configureOptions(OptionsResolver $resolver)
5959
$resolver->setAllowedTypes('scale', array('null', 'int'));
6060
}
6161

62-
/**
63-
* {@inheritdoc}
64-
*/
65-
public function getName()
66-
{
67-
return $this->getBlockPrefix();
68-
}
69-
7062
/**
7163
* {@inheritdoc}
7264
*/

‎src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ public function getParent()
3636
return __NAMESPACE__.'\ChoiceType';
3737
}
3838

39-
/**
40-
* {@inheritdoc}
41-
*/
42-
public function getName()
43-
{
44-
return $this->getBlockPrefix();
45-
}
46-
4739
/**
4840
* {@inheritdoc}
4941
*/

‎src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ public function getParent()
3636
return __NAMESPACE__.'\ChoiceType';
3737
}
3838

39-
/**
40-
* {@inheritdoc}
41-
*/
42-
public function getName()
43-
{
44-
return $this->getBlockPrefix();
45-
}
46-
4739
/**
4840
* {@inheritdoc}
4941
*/

‎src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ public function configureOptions(OptionsResolver $resolver)
6262
$resolver->setAllowedTypes('scale', 'int');
6363
}
6464

65-
/**
66-
* {@inheritdoc}
67-
*/
68-
public function getName()
69-
{
70-
return $this->getBlockPrefix();
71-
}
72-
7365
/**
7466
* {@inheritdoc}
7567
*/

‎src/Symfony/Component/Form/Extension/Core/Type/NumberType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ public function configureOptions(OptionsResolver $resolver)
5757
$resolver->setAllowedTypes('scale', array('null', 'int'));
5858
}
5959

60-
/**
61-
* {@inheritdoc}
62-
*/
63-
public function getName()
64-
{
65-
return $this->getBlockPrefix();
66-
}
67-
6860
/**
6961
* {@inheritdoc}
7062
*/

‎src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ public function getParent()
4747
return __NAMESPACE__.'\TextType';
4848
}
4949

50-
/**
51-
* {@inheritdoc}
52-
*/
53-
public function getName()
54-
{
55-
return $this->getBlockPrefix();
56-
}
57-
5850
/**
5951
* {@inheritdoc}
6052
*/

‎src/Symfony/Component/Form/Extension/Core/Type/PercentType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ public function configureOptions(OptionsResolver $resolver)
4646
$resolver->setAllowedTypes('scale', 'int');
4747
}
4848

49-
/**
50-
* {@inheritdoc}
51-
*/
52-
public function getName()
53-
{
54-
return $this->getBlockPrefix();
55-
}
56-
5749
/**
5850
* {@inheritdoc}
5951
*/

‎src/Symfony/Component/Form/Extension/Core/Type/RadioType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/RadioType.php
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ public function getParent()
2323
return __NAMESPACE__.'\CheckboxType';
2424
}
2525

26-
/**
27-
* {@inheritdoc}
28-
*/
29-
public function getName()
30-
{
31-
return $this->getBlockPrefix();
32-
}
33-
3426
/**
3527
* {@inheritdoc}
3628
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.