Skip to content

Commit 5b2836f

Browse files
committed
[Form] Removed deprecated code scheduled for removal in 2.3
1 parent 490454b commit 5b2836f

11 files changed

+33
-236
lines changed

ButtonBuilder.php

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -162,52 +162,6 @@ public function getForm()
162162
return new Button($this->getFormConfig());
163163
}
164164

165-
/**
166-
* Unsupported method.
167-
*
168-
* Does nothing.
169-
*
170-
* @param FormBuilderInterface $parent The parent builder
171-
*
172-
* @deprecated Deprecated since version 2.2, to be removed in 2.3. You
173-
* should not rely on the parent of a builder, because it is
174-
* likely that the parent is only set after turning the builder
175-
* into a form.
176-
*/
177-
public function setParent(FormBuilderInterface $parent = null)
178-
{
179-
}
180-
181-
/**
182-
* Unsupported method.
183-
*
184-
* @return null Always returns null.
185-
*
186-
* @deprecated Deprecated since version 2.2, to be removed in 2.3. You
187-
* should not rely on the parent of a builder, because it is
188-
* likely that the parent is only set after turning the builder
189-
* into a form.
190-
*/
191-
public function getParent()
192-
{
193-
return null;
194-
}
195-
196-
/**
197-
* Unsupported method.
198-
*
199-
* @return Boolean Always returns false.
200-
*
201-
* @deprecated Deprecated since version 2.2, to be removed in 2.3. You
202-
* should not rely on the parent of a builder, because it is
203-
* likely that the parent is only set after turning the builder
204-
* into a form.
205-
*/
206-
public function hasParent()
207-
{
208-
return false;
209-
}
210-
211165
/**
212166
* Unsupported method.
213167
*
@@ -238,22 +192,6 @@ public function addEventSubscriber(EventSubscriberInterface $subscriber)
238192
throw new \BadMethodCallException('Buttons do not support event subscribers.');
239193
}
240194

241-
/**
242-
* Unsupported method.
243-
*
244-
* This method should not be invoked.
245-
*
246-
* @param FormValidatorInterface $validator
247-
*
248-
* @throws \BadMethodCallException
249-
*
250-
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
251-
*/
252-
public function addValidator(FormValidatorInterface $validator)
253-
{
254-
throw new \BadMethodCallException('Buttons do not support validators.');
255-
}
256-
257195
/**
258196
* Unsupported method.
259197
*
@@ -640,18 +578,6 @@ public function getDataMapper()
640578
return null;
641579
}
642580

643-
/**
644-
* Unsupported method.
645-
*
646-
* @return array Always returns null.
647-
*
648-
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
649-
*/
650-
public function getValidators()
651-
{
652-
return array();
653-
}
654-
655581
/**
656582
* Unsupported method.
657583
*

Extension/Validator/Type/FormTypeValidatorExtension.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,15 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
5555
{
5656
parent::setDefaultOptions($resolver);
5757

58-
// BC clause
59-
$constraints = function (Options $options) {
60-
return $options['validation_constraint'];
61-
};
62-
6358
// Constraint should always be converted to an array
6459
$constraintsNormalizer = function (Options $options, $constraints) {
6560
return is_object($constraints) ? array($constraints) : (array) $constraints;
6661
};
6762

6863
$resolver->setDefaults(array(
6964
'error_mapping' => array(),
70-
// "validation_constraint" is deprecated. Use "constraints".
7165
'validation_constraint' => null,
72-
'constraints' => $constraints,
66+
'constraints' => array(),
7367
'cascade_validation' => false,
7468
'invalid_message' => 'This value is not valid.',
7569
'invalid_message_parameters' => array(),

FormBuilder.php

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
3737
*/
3838
private $unresolvedChildren = array();
3939

40-
/**
41-
* The parent of this builder.
42-
*
43-
* @var FormBuilder
44-
*/
45-
private $parent;
46-
4740
/**
4841
* Creates a new form builder.
4942
*
@@ -70,7 +63,6 @@ public function add($child, $type = null, array $options = array())
7063
}
7164

7265
if ($child instanceof self) {
73-
$child->setParent($this);
7466
$this->children[$child->getName()] = $child;
7567

7668
// In case an unresolved child with the same name exists
@@ -111,10 +103,10 @@ public function create($name, $type = null, array $options = array())
111103
}
112104

113105
if (null !== $type) {
114-
return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options, $this);
106+
return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options);
115107
}
116108

117-
return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options, $this);
109+
return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options);
118110
}
119111

120112
/**
@@ -149,9 +141,6 @@ public function remove($name)
149141
unset($this->unresolvedChildren[$name]);
150142

151143
if (array_key_exists($name, $this->children)) {
152-
if ($this->children[$name] instanceof self) {
153-
$this->children[$name]->setParent(null);
154-
}
155144
unset($this->children[$name]);
156145
}
157146

@@ -211,7 +200,6 @@ public function getFormConfig()
211200
{
212201
$config = parent::getFormConfig();
213202

214-
$config->parent = null;
215203
$config->children = array();
216204
$config->unresolvedChildren = array();
217205

@@ -238,44 +226,6 @@ public function getForm()
238226
return $form;
239227
}
240228

241-
/**
242-
* {@inheritdoc}
243-
*/
244-
public function getParent()
245-
{
246-
if ($this->locked) {
247-
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
248-
}
249-
250-
return $this->parent;
251-
}
252-
253-
/**
254-
* {@inheritdoc}
255-
*/
256-
public function setParent(FormBuilderInterface $parent = null)
257-
{
258-
if ($this->locked) {
259-
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
260-
}
261-
262-
$this->parent = $parent;
263-
264-
return $this;
265-
}
266-
267-
/**
268-
* {@inheritdoc}
269-
*/
270-
public function hasParent()
271-
{
272-
if ($this->locked) {
273-
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
274-
}
275-
276-
return null !== $this->parent;
277-
}
278-
279229
/**
280230
* {@inheritdoc}
281231
*/

FormEvents.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/*
43
* This file is part of the Symfony package.
54
*

FormFactory.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,43 +34,43 @@ public function __construct(FormRegistryInterface $registry, ResolvedFormTypeFac
3434
/**
3535
* {@inheritdoc}
3636
*/
37-
public function create($type = 'form', $data = null, array $options = array(), FormBuilderInterface $parent = null)
37+
public function create($type = 'form', $data = null, array $options = array())
3838
{
39-
return $this->createBuilder($type, $data, $options, $parent)->getForm();
39+
return $this->createBuilder($type, $data, $options)->getForm();
4040
}
4141

4242
/**
4343
* {@inheritdoc}
4444
*/
45-
public function createNamed($name, $type = 'form', $data = null, array $options = array(), FormBuilderInterface $parent = null)
45+
public function createNamed($name, $type = 'form', $data = null, array $options = array())
4646
{
47-
return $this->createNamedBuilder($name, $type, $data, $options, $parent)->getForm();
47+
return $this->createNamedBuilder($name, $type, $data, $options)->getForm();
4848
}
4949

5050
/**
5151
* {@inheritdoc}
5252
*/
53-
public function createForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null)
53+
public function createForProperty($class, $property, $data = null, array $options = array())
5454
{
55-
return $this->createBuilderForProperty($class, $property, $data, $options, $parent)->getForm();
55+
return $this->createBuilderForProperty($class, $property, $data, $options)->getForm();
5656
}
5757

5858
/**
5959
* {@inheritdoc}
6060
*/
61-
public function createBuilder($type = 'form', $data = null, array $options = array(), FormBuilderInterface $parent = null)
61+
public function createBuilder($type = 'form', $data = null, array $options = array())
6262
{
6363
$name = $type instanceof FormTypeInterface || $type instanceof ResolvedFormTypeInterface
6464
? $type->getName()
6565
: $type;
6666

67-
return $this->createNamedBuilder($name, $type, $data, $options, $parent);
67+
return $this->createNamedBuilder($name, $type, $data, $options);
6868
}
6969

7070
/**
7171
* {@inheritdoc}
7272
*/
73-
public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array(), FormBuilderInterface $parent = null)
73+
public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array())
7474
{
7575
if (null !== $data && !array_key_exists('data', $options)) {
7676
$options['data'] = $data;
@@ -84,16 +84,16 @@ public function createNamedBuilder($name, $type = 'form', $data = null, array $o
8484
throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface');
8585
}
8686

87-
return $type->createBuilder($this, $name, $options, $parent);
87+
return $type->createBuilder($this, $name, $options);
8888
}
8989

9090
/**
9191
* {@inheritdoc}
9292
*/
93-
public function createBuilderForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null)
93+
public function createBuilderForProperty($class, $property, $data = null, array $options = array())
9494
{
9595
if (null === $guesser = $this->registry->getTypeGuesser()) {
96-
return $this->createNamedBuilder($property, 'text', $data, $options, $parent);
96+
return $this->createNamedBuilder($property, 'text', $data, $options);
9797
}
9898

9999
$typeGuess = $guesser->guessType($class, $property);
@@ -123,7 +123,7 @@ public function createBuilderForProperty($class, $property, $data = null, array
123123
$options = array_merge($typeGuess->getOptions(), $options);
124124
}
125125

126-
return $this->createNamedBuilder($property, $type, $data, $options, $parent);
126+
return $this->createNamedBuilder($property, $type, $data, $options);
127127
}
128128

129129
/**

0 commit comments

Comments
 (0)