Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Form] removed deprecated methods and classes

  • Loading branch information...
commit b3081e85a062abb8fc8a22f20a2b3289db2ff501 1 parent e0385a2
@fabpot fabpot authored
Showing with 54 additions and 1,741 deletions.
  1. +0 −8 src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
  2. +0 −8 src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php
  3. +0 −82 src/Symfony/Component/Form/AbstractType.php
  4. +0 −40 src/Symfony/Component/Form/AbstractTypeExtension.php
  5. +0 −44 src/Symfony/Component/Form/CallbackValidator.php
  6. +0 −74 src/Symfony/Component/Form/Event/DataEvent.php
  7. +0 −22 src/Symfony/Component/Form/Event/FilterDataEvent.php
  8. +0 −1  src/Symfony/Component/Form/Extension/Core/CoreExtension.php
  9. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
  10. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
  11. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
  12. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/DateType.php
  13. +0 −32 src/Symfony/Component/Form/Extension/Core/Type/FieldType.php
  14. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/FileType.php
  15. +2 −12 src/Symfony/Component/Form/Extension/Core/Type/FormType.php
  16. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
  17. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
  18. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
  19. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
  20. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
  21. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/TextType.php
  22. +0 −8 src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
  23. +1 −8 src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
  24. +0 −8 src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
  25. +3 −226 src/Symfony/Component/Form/Form.php
  26. +0 −28 src/Symfony/Component/Form/FormBuilder.php
  27. +0 −38 src/Symfony/Component/Form/FormBuilderInterface.php
  28. +0 −188 src/Symfony/Component/Form/FormConfigBuilder.php
  29. +0 −11 src/Symfony/Component/Form/FormConfigBuilderInterface.php
  30. +0 −9 src/Symfony/Component/Form/FormConfigInterface.php
  31. +46 −2 src/Symfony/Component/Form/FormEvent.php
  32. +0 −18 src/Symfony/Component/Form/FormEvents.php
  33. +0 −70 src/Symfony/Component/Form/FormFactory.php
  34. +2 −14 src/Symfony/Component/Form/FormRegistry.php
  35. +0 −11 src/Symfony/Component/Form/FormRegistryInterface.php
  36. +0 −12 src/Symfony/Component/Form/FormTypeGuesserChain.php
  37. +0 −12 src/Symfony/Component/Form/FormTypeGuesserInterface.php
  38. +0 −28 src/Symfony/Component/Form/FormValidatorInterface.php
  39. +0 −233 src/Symfony/Component/Form/FormView.php
  40. +0 −8 src/Symfony/Component/Form/ResolvedFormType.php
  41. +0 −16 src/Symfony/Component/Form/Tests/CompoundFormTest.php
  42. +0 −13 src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
  43. +0 −118 src/Symfony/Component/Form/Tests/FormFactoryTest.php
  44. +0 −32 src/Symfony/Component/Form/Tests/FormRegistryTest.php
  45. +0 −21 src/Symfony/Component/Form/Tests/SimpleFormTest.php
  46. +0 −15 src/Symfony/Component/Form/Util/FormUtil.php
  47. +0 −57 src/Symfony/Component/Form/Util/PropertyPath.php
  48. +0 −36 src/Symfony/Component/Form/Util/PropertyPathBuilder.php
  49. +0 −27 src/Symfony/Component/Form/Util/PropertyPathInterface.php
  50. +0 −36 src/Symfony/Component/Form/Util/PropertyPathIterator.php
  51. +0 −27 src/Symfony/Component/Form/Util/PropertyPathIteratorInterface.php
View
8 src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
@@ -141,14 +141,6 @@ public function guessMaxLength($class, $property)
/**
* {@inheritDoc}
*/
- public function guessMinLength($class, $property)
- {
- trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
- }
-
- /**
- * {@inheritDoc}
- */
public function guessPattern($class, $property)
{
$ret = $this->getMetadata($class);
View
8 src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php
@@ -132,14 +132,6 @@ public function guessMaxLength($class, $property)
/**
* {@inheritDoc}
*/
- public function guessMinLength($class, $property)
- {
- trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
- }
-
- /**
- * {@inheritDoc}
- */
public function guessPattern($class, $property)
{
if ($column = $this->getColumn($class, $property)) {
View
82 src/Symfony/Component/Form/AbstractType.php
@@ -19,13 +19,6 @@
abstract class AbstractType implements FormTypeInterface
{
/**
- * @var array
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- private $extensions = array();
-
- /**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
@@ -51,50 +44,6 @@ public function finishView(FormView $view, FormInterface $form, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
- $defaults = $this->getDefaultOptions(array());
- $allowedTypes = $this->getAllowedOptionValues(array());
-
- if (!empty($defaults)) {
- trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
-
- $resolver->setDefaults($defaults);
- }
-
- if (!empty($allowedTypes)) {
- trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
-
- $resolver->addAllowedValues($allowedTypes);
- }
- }
-
- /**
- * Returns the default options for this type.
- *
- * @param array $options Unsupported as of Symfony 2.1.
- *
- * @return array The default options
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link setDefaultOptions()} instead.
- */
- public function getDefaultOptions(array $options)
- {
- return array();
- }
-
- /**
- * Returns the allowed option values for each option (if any).
- *
- * @param array $options Unsupported as of Symfony 2.1.
- *
- * @return array The allowed option values
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link setDefaultOptions()} instead.
- */
- public function getAllowedOptionValues(array $options)
- {
- return array();
}
/**
@@ -104,35 +53,4 @@ public function getParent()
{
return 'form';
}
-
- /**
- * Sets the extensions for this type.
- *
- * @param FormTypeExtensionInterface[] $extensions An array of FormTypeExtensionInterface
- *
- * @throws Exception\UnexpectedTypeException if any extension does not implement FormTypeExtensionInterface
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function setExtensions(array $extensions)
- {
- trigger_error('setExtensions() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- $this->extensions = $extensions;
- }
-
- /**
- * Returns the extensions associated with this type.
- *
- * @return FormTypeExtensionInterface[] An array of FormTypeExtensionInterface
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link ResolvedFormTypeInterface::getTypeExtensions()} instead.
- */
- public function getExtensions()
- {
- trigger_error('getExtensions() is deprecated since version 2.1 and will be removed in 2.3. Use ResolvedFormTypeInterface::getTypeExtensions instead.', E_USER_DEPRECATED);
-
- return $this->extensions;
- }
}
View
40 src/Symfony/Component/Form/AbstractTypeExtension.php
@@ -44,45 +44,5 @@ public function finishView(FormView $view, FormInterface $form, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
- $defaults = $this->getDefaultOptions(array());
- $allowedTypes = $this->getAllowedOptionValues(array());
-
- if (!empty($defaults)) {
- trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
-
- $resolver->setDefaults($defaults);
- }
-
- if (!empty($allowedTypes)) {
- trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED);
-
- $resolver->addAllowedValues($allowedTypes);
- }
- }
-
- /**
- * Overrides the default options form the extended type.
- *
- * @return array
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link setDefaultOptions()} instead.
- */
- public function getDefaultOptions()
- {
- return array();
- }
-
- /**
- * Returns the allowed option values for each option (if any).
- *
- * @return array The allowed option values
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link setDefaultOptions()} instead.
- */
- public function getAllowedOptionValues()
- {
- return array();
}
}
View
44 src/Symfony/Component/Form/CallbackValidator.php
@@ -1,44 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Form;
-
-/**
- * Deprecated. You should use FormEvents::POST_BIND event listeners instead.
- *
- * @author Bernhard Schussek <bschussek@gmail.com>
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
-class CallbackValidator implements FormValidatorInterface
-{
- private $callback;
-
- /**
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function __construct($callback)
- {
- trigger_error('CallbackValidator is deprecated since version 2.1 and will be removed in 2.3. Use the FormEvents::POST_BIND event instead.', E_USER_DEPRECATED);
-
- $this->callback = $callback;
- }
-
- /**
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function validate(FormInterface $form)
- {
- trigger_error('validate() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- return call_user_func($this->callback, $form);
- }
-}
View
74 src/Symfony/Component/Form/Event/DataEvent.php
@@ -1,74 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Form\Event;
-
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\Form\FormInterface;
-use Symfony\Component\Form\FormEvent;
-
-/**
- * @author Bernhard Schussek <bschussek@gmail.com>
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Code against
- * {@link \Symfony\Component\Form\FormEvent} instead.
- */
-class DataEvent extends Event
-{
- private $form;
- protected $data;
-
- /**
- * Constructs an event.
- *
- * @param FormInterface $form The associated form
- * @param mixed $data The data
- */
- public function __construct(FormInterface $form, $data)
- {
- if (!$this instanceof FormEvent) {
- trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 2.3. Code against \Symfony\Component\Form\FormEvent instead.', get_class($this)), E_USER_DEPRECATED);
- }
-
- $this->form = $form;
- $this->data = $data;
- }
-
- /**
- * Returns the form at the source of the event.
- *
- * @return FormInterface
- */
- public function getForm()
- {
- return $this->form;
- }
-
- /**
- * Returns the data associated with this event.
- *
- * @return mixed
- */
- public function getData()
- {
- return $this->data;
- }
-
- /**
- * Allows updating with some filtered data.
- *
- * @param mixed $data
- */
- public function setData($data)
- {
- $this->data = $data;
- }
-}
View
22 src/Symfony/Component/Form/Event/FilterDataEvent.php
@@ -1,22 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Form\Event;
-
-/**
- * @author Bernhard Schussek <bschussek@gmail.com>
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Code against
- * {@link \Symfony\Component\Form\FormEvent} instead.
- */
-class FilterDataEvent extends DataEvent
-{
-}
View
1  src/Symfony/Component/Form/Extension/Core/CoreExtension.php
@@ -24,7 +24,6 @@ class CoreExtension extends AbstractExtension
protected function loadTypes()
{
return array(
- new Type\FieldType(),
new Type\FormType(PropertyAccess::getPropertyAccessor()),
new Type\BirthdayType(),
new Type\CheckboxType(),
View
8 src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
@@ -60,14 +60,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'checkbox';
View
8 src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
@@ -214,14 +214,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'choice';
View
8 src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
@@ -287,14 +287,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'datetime';
View
8 src/Symfony/Component/Form/Extension/Core/Type/DateType.php
@@ -250,14 +250,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'date';
View
32 src/Symfony/Component/Form/Extension/Core/Type/FieldType.php
@@ -1,32 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Form\Extension\Core\Type;
-
-use Symfony\Component\Form\AbstractType;
-
-/**
- * Deprecated. You should extend FormType instead.
- *
- * @author Bernhard Schussek <bschussek@gmail.com>
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
-class FieldType extends AbstractType
-{
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return 'field';
- }
-}
View
8 src/Symfony/Component/Form/Extension/Core/Type/FileType.php
@@ -54,14 +54,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'file';
View
14 src/Symfony/Component/Form/Extension/Core/Type/FormType.php
@@ -45,8 +45,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->setDisabled($options['disabled'])
->setErrorBubbling($options['error_bubbling'])
->setEmptyData($options['empty_data'])
- // BC compatibility, when "property_path" could be false
- ->setPropertyPath(is_string($options['property_path']) ? $options['property_path'] : null)
+ ->setPropertyPath($options['property_path'])
->setMapped($options['mapped'])
->setByReference($options['by_reference'])
->setVirtual($options['virtual'])
@@ -56,10 +55,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->setDataMapper($options['compound'] ? new PropertyPathMapper($this->propertyAccessor) : null)
;
- if (false === $options['property_path']) {
- trigger_error('Setting "property_path" to "false" is deprecated since version 2.1 and will be removed in 2.3. Set "mapped" to "false" instead.', E_USER_DEPRECATED);
- }
-
if ($options['trim']) {
$builder->addEventSubscriber(new TrimListener());
}
@@ -200,11 +195,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
return $options['compound'];
};
- // BC clause: former property_path=false now equals mapped=false
- $mapped = function (Options $options) {
- return false !== $options['property_path'];
- };
-
// If data is given, the form is locked to that data
// (independent of its value)
$resolver->setOptional(array(
@@ -222,7 +212,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'max_length' => null,
'pattern' => null,
'property_path' => null,
- 'mapped' => $mapped,
+ 'mapped' => true,
'by_reference' => true,
'error_bubbling' => $errorBubbling,
'label' => null,
View
8 src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
@@ -33,14 +33,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'hidden';
View
8 src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
@@ -61,14 +61,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'integer';
View
8 src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
@@ -62,14 +62,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'money';
View
8 src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
@@ -59,14 +59,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'number';
View
8 src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
@@ -48,14 +48,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'percent';
View
8 src/Symfony/Component/Form/Extension/Core/Type/TextType.php
@@ -29,14 +29,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'text';
View
8 src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
@@ -231,14 +231,6 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function getParent()
- {
- return 'field';
- }
-
- /**
- * {@inheritdoc}
- */
public function getName()
{
return 'time';
View
9 src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
@@ -53,11 +53,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
- // BC clause
- $constraints = function (Options $options) {
- return $options['validation_constraint'];
- };
-
// Make sure that validation groups end up as null, closure or array
$validationGroupsNormalizer = function (Options $options, $groups) {
if (empty($groups)) {
@@ -79,9 +74,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
$resolver->setDefaults(array(
'error_mapping' => array(),
'validation_groups' => null,
- // "validation_constraint" is deprecated. Use "constraints".
- 'validation_constraint' => null,
- 'constraints' => $constraints,
+ 'constraints' => null,
'cascade_validation' => false,
'invalid_message' => 'This value is not valid.',
'invalid_message_parameters' => array(),
View
8 src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
@@ -68,14 +68,6 @@ public function guessMaxLength($class, $property)
/**
* {@inheritDoc}
*/
- public function guessMinLength($class, $property)
- {
- trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
- }
-
- /**
- * {@inheritDoc}
- */
public function guessPattern($class, $property)
{
$guesser = $this;
View
229 src/Symfony/Component/Form/Form.php
@@ -16,7 +16,6 @@
use Symfony\Component\Form\Exception\AlreadyBoundException;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Util\FormUtil;
-use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\PropertyAccess\PropertyPath;
/**
@@ -202,27 +201,6 @@ public function getPropertyPath()
}
/**
- * Returns the types used by this form.
- *
- * @return FormTypeInterface[] An array of FormTypeInterface
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getConfig()} and {@link FormConfigInterface::getType()} instead.
- */
- public function getTypes()
- {
- trigger_error('getTypes() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getType() instead.', E_USER_DEPRECATED);
-
- $types = array();
-
- for ($type = $this->config->getType(); null !== $type; $type = $type->getParent()) {
- array_unshift($types, $type->getInnerType());
- }
-
- return $types;
- }
-
- /**
* {@inheritdoc}
*/
public function isRequired()
@@ -273,21 +251,6 @@ public function getParent()
}
/**
- * Returns whether the form has a parent.
- *
- * @return Boolean
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getParent()} or inverse {@link isRoot()} instead.
- */
- public function hasParent()
- {
- trigger_error('hasParent() is deprecated since version 2.1 and will be removed in 2.3. Use getParent() or inverse isRoot() instead.', E_USER_DEPRECATED);
-
- return null !== $this->parent;
- }
-
- /**
* {@inheritdoc}
*/
public function getRoot()
@@ -304,40 +267,6 @@ public function isRoot()
}
/**
- * Returns whether the form has an attribute with the given name.
- *
- * @param string $name The name of the attribute.
- *
- * @return Boolean Whether the attribute exists.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getConfig()} and {@link FormConfigInterface::hasAttribute()} instead.
- */
- public function hasAttribute($name)
- {
- trigger_error('hasAttribute() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::hasAttribute() instead.', E_USER_DEPRECATED);
-
- return $this->config->hasAttribute($name);
- }
-
- /**
- * Returns the value of the attributes with the given name.
- *
- * @param string $name The name of the attribute
- *
- * @return mixed The attribute value.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getConfig()} and {@link FormConfigInterface::getAttribute()} instead.
- */
- public function getAttribute($name)
- {
- trigger_error('getAttribute() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getAttribute() instead.', E_USER_DEPRECATED);
-
- return $this->config->getAttribute($name);
- }
-
- /**
* {@inheritdoc}
*/
public function setData($modelData)
@@ -366,14 +295,9 @@ public function setData($modelData)
$dispatcher = $this->config->getEventDispatcher();
// Hook to change content of the data
- if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA) || $dispatcher->hasListeners(FormEvents::SET_DATA)) {
+ if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA)) {
$event = new FormEvent($this, $modelData);
$dispatcher->dispatch(FormEvents::PRE_SET_DATA, $event);
- // BC until 2.3
- if ($dispatcher->hasListeners(FormEvents::SET_DATA)) {
- trigger_error('The FormEvents::SET_DATA event is deprecated since 2.1 and will be removed in 2.3. Use the FormEvents::PRE_SET_DATA event instead.', E_USER_DEPRECATED);
- }
- $dispatcher->dispatch(FormEvents::SET_DATA, $event);
$modelData = $event->getData();
}
@@ -473,21 +397,6 @@ public function getViewData()
}
/**
- * Alias of {@link getViewData()}.
- *
- * @return string
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getViewData()} instead.
- */
- public function getClientData()
- {
- trigger_error('getClientData() is deprecated since version 2.1 and will be removed in 2.3. Use getViewData() instead.', E_USER_DEPRECATED);
-
- return $this->getViewData();
- }
-
- /**
* {@inheritdoc}
*/
public function getExtraData()
@@ -532,14 +441,9 @@ public function bind($submittedData)
$dispatcher = $this->config->getEventDispatcher();
// Hook to change content of the data bound by the browser
- if ($dispatcher->hasListeners(FormEvents::PRE_BIND) || $dispatcher->hasListeners(FormEvents::BIND_CLIENT_DATA)) {
+ if ($dispatcher->hasListeners(FormEvents::PRE_BIND)) {
$event = new FormEvent($this, $submittedData);
$dispatcher->dispatch(FormEvents::PRE_BIND, $event);
- // BC until 2.3
- if ($dispatcher->hasListeners(FormEvents::BIND_CLIENT_DATA)) {
- trigger_error('The FormEvents::BIND_CLIENT_DATA event is deprecated since 2.1 and will be removed in 2.3. Use the FormEvents::PRE_BIND event instead.', E_USER_DEPRECATED);
- }
- $dispatcher->dispatch(FormEvents::BIND_CLIENT_DATA, $event);
$submittedData = $event->getData();
}
@@ -595,14 +499,9 @@ public function bind($submittedData)
// Hook to change content of the data into the normalized
// representation
- if ($dispatcher->hasListeners(FormEvents::BIND) || $dispatcher->hasListeners(FormEvents::BIND_NORM_DATA)) {
+ if ($dispatcher->hasListeners(FormEvents::BIND)) {
$event = new FormEvent($this, $normData);
$dispatcher->dispatch(FormEvents::BIND, $event);
- // BC until 2.3
- if ($dispatcher->hasListeners(FormEvents::BIND_NORM_DATA)) {
- trigger_error('The FormEvents::BIND_NORM_DATA event is deprecated since 2.1 and will be removed in 2.3. Use the FormEvents::BIND event instead.', E_USER_DEPRECATED);
- }
- $dispatcher->dispatch(FormEvents::BIND_NORM_DATA, $event);
$normData = $event->getData();
}
@@ -623,42 +522,10 @@ public function bind($submittedData)
$dispatcher->dispatch(FormEvents::POST_BIND, $event);
}
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
- $validators = $this->config->getValidators();
- restore_error_handler();
-
- foreach ($validators as $validator) {
- trigger_error(sprintf('FormConfigInterface::getValidators() is deprecated since 2.1 and will be removed in 2.3. Convert your %s class to a listener on the FormEvents::POST_BIND event.', get_class($validator)), E_USER_DEPRECATED);
-
- $validator->validate($this);
- }
-
return $this;
}
/**
- * Binds a request to the form.
- *
- * If the request method is POST, PUT or GET, the data is bound to the form,
- * transformed and written into the form data (an object or an array).
- *
- * @param Request $request The request to bind to the form
- *
- * @return Form This form
- *
- * @throws FormException if the method of the request is not one of GET, POST or PUT
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link FormConfigInterface::bind()} instead.
- */
- public function bindRequest(Request $request)
- {
- trigger_error('bindRequest() is deprecated since version 2.1 and will be removed in 2.3. Use FormConfigInterface::bind() instead.', E_USER_DEPRECATED);
-
- return $this->bind($request);
- }
-
- /**
* {@inheritdoc}
*/
public function addError(FormError $error)
@@ -673,21 +540,6 @@ public function addError(FormError $error)
}
/**
- * Returns whether errors bubble up to the parent.
- *
- * @return Boolean
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getConfig()} and {@link FormConfigInterface::getErrorBubbling()} instead.
- */
- public function getErrorBubbling()
- {
- trigger_error('getErrorBubbling() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getErrorBubbling() instead.', E_USER_DEPRECATED);
-
- return $this->config->getErrorBubbling();
- }
-
- /**
* {@inheritdoc}
*/
public function isBound()
@@ -746,21 +598,6 @@ public function isValid()
}
/**
- * Returns whether there are errors associated with this form.
- *
- * @return Boolean
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Count
- * {@link getErrors()} instead.
- */
- public function hasErrors()
- {
- trigger_error('hasErrors() is deprecated since version 2.1 and will be removed in 2.3. Count getErrors() instead.', E_USER_DEPRECATED);
-
- return count($this->errors) > 0;
- }
-
- /**
* {@inheritdoc}
*/
public function getErrors()
@@ -797,36 +634,6 @@ public function getErrorsAsString($level = 0)
}
/**
- * Returns the model transformers of the form.
- *
- * @return DataTransformerInterface[] An array of DataTransformerInterface
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getConfig()} and {@link FormConfigInterface::getModelTransformers()} instead.
- */
- public function getNormTransformers()
- {
- trigger_error('getNormTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getModelTransformers() instead.', E_USER_DEPRECATED);
-
- return $this->config->getModelTransformers();
- }
-
- /**
- * Returns the view transformers of the form.
- *
- * @return DataTransformerInterface[] An array of DataTransformerInterface
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getConfig()} and {@link FormConfigInterface::getViewTransformers()} instead.
- */
- public function getClientTransformers()
- {
- trigger_error('getClientTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getViewTransformers() instead.', E_USER_DEPRECATED);
-
- return $this->config->getViewTransformers();
- }
-
- /**
* {@inheritdoc}
*/
public function all()
@@ -835,36 +642,6 @@ public function all()
}
/**
- * Returns all children in this group.
- *
- * @return array
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link all()} instead.
- */
- public function getChildren()
- {
- trigger_error('getChildren() is deprecated since version 2.1 and will be removed in 2.3. Use all() instead.', E_USER_DEPRECATED);
-
- return $this->all();
- }
-
- /**
- * Returns whether the form has children.
- *
- * @return Boolean
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link count()} instead.
- */
- public function hasChildren()
- {
- trigger_error('hasChildren() is deprecated since version 2.1 and will be removed in 2.3. Use count() instead.', E_USER_DEPRECATED);
-
- return count($this->children) > 0;
- }
-
- /**
* {@inheritdoc}
*/
public function add($child, $type = null, array $options = array())
View
28 src/Symfony/Component/Form/FormBuilder.php
@@ -289,34 +289,6 @@ public function getIterator()
}
/**
- * Returns the types used by this builder.
- *
- * @return FormTypeInterface[] An array of FormTypeInterface
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link FormConfigInterface::getType()} instead.
- *
- * @throws BadMethodCallException If the builder was turned into a {@link FormConfigInterface}
- * via {@link getFormConfig()}.
- */
- public function getTypes()
- {
- trigger_error('getTypes() is deprecated since version 2.1 and will be removed in 2.3. Use getConfig() and FormConfigInterface::getType() instead.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- $types = array();
-
- for ($type = $this->getType(); null !== $type; $type = $type->getParent()) {
- array_unshift($types, $type->getInnerType());
- }
-
- return $types;
- }
-
- /**
* Converts an unresolved child into a {@link FormBuilder} instance.
*
* @param string $name The name of the unresolved child.
View
38 src/Symfony/Component/Form/FormBuilderInterface.php
@@ -84,42 +84,4 @@ public function all();
* @return Form The form
*/
public function getForm();
-
- /**
- * Sets the parent builder.
- *
- * @param FormBuilderInterface $parent The parent builder
- *
- * @return FormBuilderInterface The builder object.
- *
- * @deprecated Deprecated since version 2.2, to be removed in 2.3. You
- * should not rely on the parent of a builder, because it is
- * likely that the parent is only set after turning the builder
- * into a form.
- */
- public function setParent(FormBuilderInterface $parent = null);
-
- /**
- * Returns the parent builder.
- *
- * @return FormBuilderInterface The parent builder
- *
- * @deprecated Deprecated since version 2.2, to be removed in 2.3. You
- * should not rely on the parent of a builder, because it is
- * likely that the parent is only set after turning the builder
- * into a form.
- */
- public function getParent();
-
- /**
- * Returns whether the builder has a parent.
- *
- * @return Boolean
- *
- * @deprecated Deprecated since version 2.2, to be removed in 2.3. You
- * should not rely on the parent of a builder, because it is
- * likely that the parent is only set after turning the builder
- * into a form.
- */
- public function hasParent();
}
View
188 src/Symfony/Component/Form/FormConfigBuilder.php
@@ -198,22 +198,6 @@ public function addEventSubscriber(EventSubscriberInterface $subscriber)
/**
* {@inheritdoc}
*/
- public function addValidator(FormValidatorInterface $validator)
- {
- trigger_error('addValidator() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- $this->validators[] = $validator;
-
- return $this;
- }
-
- /**
- * {@inheritdoc}
- */
public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false)
{
if ($this->locked) {
@@ -244,72 +228,6 @@ public function resetViewTransformers()
}
/**
- * Alias of {@link addViewTransformer()}.
- *
- * @param DataTransformerInterface $viewTransformer
- *
- * @return FormConfigBuilder The configuration object.
- *
- * @throws BadMethodCallException if the form configuration is locked
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link addViewTransformer()} instead.
- */
- public function appendClientTransformer(DataTransformerInterface $viewTransformer)
- {
- trigger_error('appendClientTransformer() is deprecated since version 2.1 and will be removed in 2.3. Use addViewTransformer() instead.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- return $this->addViewTransformer($viewTransformer);
- }
-
- /**
- * Prepends a transformer to the client transformer chain.
- *
- * @param DataTransformerInterface $viewTransformer
- *
- * @return FormConfigBuilder The configuration object.
- *
- * @throws BadMethodCallException if the form configuration is locked
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function prependClientTransformer(DataTransformerInterface $viewTransformer)
- {
- trigger_error('prependClientTransformer() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- return $this->addViewTransformer($viewTransformer, true);
- }
-
- /**
- * Alias of {@link resetViewTransformers()}.
- *
- * @return FormConfigBuilder The configuration object.
- *
- * @throws BadMethodCallException if the form configuration is locked
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link resetViewTransformers()} instead.
- */
- public function resetClientTransformers()
- {
- trigger_error('resetClientTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use resetViewTransformers() instead.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- return $this->resetViewTransformers();
- }
-
- /**
* {@inheritdoc}
*/
public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false)
@@ -342,72 +260,6 @@ public function resetModelTransformers()
}
/**
- * Appends a transformer to the normalization transformer chain
- *
- * @param DataTransformerInterface $modelTransformer
- *
- * @return FormConfigBuilder The configuration object.
- *
- * @throws BadMethodCallException if the form configuration is locked
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function appendNormTransformer(DataTransformerInterface $modelTransformer)
- {
- trigger_error('appendNormTransformer() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- return $this->addModelTransformer($modelTransformer, true);
- }
-
- /**
- * Alias of {@link addModelTransformer()}.
- *
- * @param DataTransformerInterface $modelTransformer
- *
- * @return FormConfigBuilder The configuration object.
- *
- * @throws BadMethodCallException if the form configuration is locked
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link addModelTransformer()} instead.
- */
- public function prependNormTransformer(DataTransformerInterface $modelTransformer)
- {
- trigger_error('prependNormTransformer() is deprecated since version 2.1 and will be removed in 2.3. Use addModelTransformer() instead.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- return $this->addModelTransformer($modelTransformer);
- }
-
- /**
- * Alias of {@link resetModelTransformers()}.
- *
- * @return FormConfigBuilder The configuration object.
- *
- * @throws BadMethodCallException if the form configuration is locked
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link resetModelTransformers()} instead.
- */
- public function resetNormTransformers()
- {
- trigger_error('resetNormTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use resetModelTransformers() instead.', E_USER_DEPRECATED);
-
- if ($this->locked) {
- throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
- }
-
- return $this->resetModelTransformers();
- }
-
- /**
* {@inheritdoc}
*/
public function getEventDispatcher()
@@ -480,21 +332,6 @@ public function getViewTransformers()
}
/**
- * Alias of {@link getViewTransformers()}.
- *
- * @return array The view transformers.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getViewTransformers()} instead.
- */
- public function getClientTransformers()
- {
- trigger_error('getClientTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getViewTransformers() instead.', E_USER_DEPRECATED);
-
- return $this->getViewTransformers();
- }
-
- /**
* {@inheritdoc}
*/
public function getModelTransformers()
@@ -503,21 +340,6 @@ public function getModelTransformers()
}
/**
- * Alias of {@link getModelTransformers()}.
- *
- * @return array The model transformers.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link getModelTransformers()} instead.
- */
- public function getNormTransformers()
- {
- trigger_error('getNormTransformers() is deprecated since version 2.1 and will be removed in 2.3. Use getModelTransformers() instead.', E_USER_DEPRECATED);
-
- return $this->getModelTransformers();
- }
-
- /**
* {@inheritdoc}
*/
public function getDataMapper()
@@ -528,16 +350,6 @@ public function getDataMapper()
/**
* {@inheritdoc}
*/
- public function getValidators()
- {
- trigger_error('getValidators() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- return $this->validators;
- }
-
- /**
- * {@inheritdoc}
- */
public function getRequired()
{
return $this->required;
View
11 src/Symfony/Component/Form/FormConfigBuilderInterface.php
@@ -41,17 +41,6 @@ public function addEventListener($eventName, $listener, $priority = 0);
public function addEventSubscriber(EventSubscriberInterface $subscriber);
/**
- * Adds a validator to the form.
- *
- * @param FormValidatorInterface $validator The validator.
- *
- * @return self The configuration object.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function addValidator(FormValidatorInterface $validator);
-
- /**
* Appends / prepends a transformer to the view transformer chain.
*
* The transform method of the transformer is used to convert data from the
View
9 src/Symfony/Component/Form/FormConfigInterface.php
@@ -105,15 +105,6 @@ public function getModelTransformers();
public function getDataMapper();
/**
- * Returns the validators of the form.
- *
- * @return FormValidatorInterface The form validator.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function getValidators();
-
- /**
* Returns whether the form is required.
*
* @return Boolean Whether the form is required.
View
48 src/Symfony/Component/Form/FormEvent.php
@@ -11,11 +11,55 @@
namespace Symfony\Component\Form;
-use Symfony\Component\Form\Event\FilterDataEvent;
+use Symfony\Component\EventDispatcher\Event;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
-class FormEvent extends FilterDataEvent
+class FormEvent extends Event
{
+ private $form;
+ protected $data;
+
+ /**
+ * Constructs an event.
+ *
+ * @param FormInterface $form The associated form
+ * @param mixed $data The data
+ */
+ public function __construct(FormInterface $form, $data)
+ {
+ $this->form = $form;
+ $this->data = $data;
+ }
+
+ /**
+ * Returns the form at the source of the event.
+ *
+ * @return FormInterface
+ */
+ public function getForm()
+ {
+ return $this->form;
+ }
+
+ /**
+ * Returns the data associated with this event.
+ *
+ * @return mixed
+ */
+ public function getData()
+ {
+ return $this->data;
+ }
+
+ /**
+ * Allows updating with some filtered data.
+ *
+ * @param mixed $data
+ */
+ public function setData($data)
+ {
+ $this->data = $data;
+ }
}
View
18 src/Symfony/Component/Form/FormEvents.php
@@ -26,24 +26,6 @@
const POST_SET_DATA = 'form.post_set_data';
- /**
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link PRE_BIND} instead.
- */
- const BIND_CLIENT_DATA = 'form.bind_client_data';
-
- /**
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link BIND} instead.
- */
- const BIND_NORM_DATA = 'form.bind_norm_data';
-
- /**
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- * Use {@link PRE_SET_DATA} instead.
- */
- const SET_DATA = 'form.set_data';
-
private function __construct()
{
}
View
70 src/Symfony/Component/Form/FormFactory.php
@@ -98,20 +98,14 @@ public function createBuilderForProperty($class, $property, $data = null, array
$typeGuess = $guesser->guessType($class, $property);
$maxLengthGuess = $guesser->guessMaxLength($class, $property);
- // Keep $minLengthGuess for BC until Symfony 2.3
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
- $minLengthGuess = $guesser->guessMinLength($class, $property);
- restore_error_handler();
$requiredGuess = $guesser->guessRequired($class, $property);
$patternGuess = $guesser->guessPattern($class, $property);
$type = $typeGuess ? $typeGuess->getType() : 'text';
$maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null;
- $minLength = $minLengthGuess ? $minLengthGuess->getValue() : null;
$pattern = $patternGuess ? $patternGuess->getValue() : null;
- // overrides $minLength, if set
if (null !== $pattern) {
$options = array_merge(array('pattern' => $pattern), $options);
}
@@ -120,10 +114,6 @@ public function createBuilderForProperty($class, $property, $data = null, array
$options = array_merge(array('max_length' => $maxLength), $options);
}
- if (null !== $minLength && $minLength > 0) {
- $options = array_merge(array('pattern' => '.{'.$minLength.','.$maxLength.'}'), $options);
- }
-
if ($requiredGuess) {
$options = array_merge(array('required' => $requiredGuess->getValue()), $options);
}
@@ -137,66 +127,6 @@ public function createBuilderForProperty($class, $property, $data = null, array
}
/**
- * Returns whether the given type is supported.
- *
- * @param string $name The name of the type
- *
- * @return Boolean Whether the type is supported
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link FormRegistryInterface::hasType()} instead.
- */
- public function hasType($name)
- {
- trigger_error('hasType() is deprecated since version 2.1 and will be removed in 2.3. Use FormRegistryInterface::hasType() instead.', E_USER_DEPRECATED);
-
- return $this->registry->hasType($name);
- }
-
- /**
- * Adds a type.
- *
- * @param FormTypeInterface $type The type
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * form extensions or type registration in the Dependency
- * Injection Container instead.
- */
- public function addType(FormTypeInterface $type)
- {
- trigger_error('addType() is deprecated since version 2.1 and will be removed in 2.3. Use form extensions or type registration in the Dependency Injection Container instead.', E_USER_DEPRECATED);
-
- $parentType = $type->getParent();
-
- $this->registry->addType($this->resolvedTypeFactory->createResolvedType(
- $type,
- array(),
- $parentType ? $this->registry->getType($parentType) : null
- ));
- }
-
- /**
- * Returns a type by name.
- *
- * This methods registers the type extensions from the form extensions.
- *
- * @param string $name The name of the type
- *
- * @return FormTypeInterface The type
- *
- * @throws Exception\FormException if the type can not be retrieved from any extension
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link FormRegistryInterface::getType()} instead.
- */
- public function getType($name)
- {
- trigger_error('getType() is deprecated since version 2.1 and will be removed in 2.3. Use FormRegistryInterface::getType() instead.', E_USER_DEPRECATED);
-
- return $this->registry->getType($name)->getInnerType();
- }
-
- /**
* Wraps a type into a ResolvedFormTypeInterface implementation and connects
* it with its parent type.
*
View
16 src/Symfony/Component/Form/FormRegistry.php
@@ -67,16 +67,6 @@ public function __construct(array $extensions, ResolvedFormTypeFactoryInterface
/**
* {@inheritdoc}
*/
- public function addType(ResolvedFormTypeInterface $type)
- {
- trigger_error('addType() is deprecated since version 2.1 and will be removed in 2.3. Use form extensions or type registration in the Dependency Injection Container instead.', E_USER_DEPRECATED);
-
- $this->types[$type->getName()] = $type;
- }
-
- /**
- * {@inheritdoc}
- */
public function getType($name)
{
if (!is_string($name)) {
@@ -132,13 +122,11 @@ private function resolveAndAddType(FormTypeInterface $type)
);
}
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
- $this->addType($this->resolvedTypeFactory->createResolvedType(
+ $this->types[$type->getName()] = $this->resolvedTypeFactory->createResolvedType(
$type,
$typeExtensions,
$parentType ? $this->getType($parentType) : null
- ));
- restore_error_handler();
+ );
}
/**
View
11 src/Symfony/Component/Form/FormRegistryInterface.php
@@ -19,17 +19,6 @@
interface FormRegistryInterface
{
/**
- * Adds a form type.
- *
- * @param ResolvedFormTypeInterface $type The type
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * form extensions or type registration in the Dependency
- * Injection Container instead.
- */
- public function addType(ResolvedFormTypeInterface $type);
-
- /**
* Returns a form type by name.
*
* This methods registers the type extensions from the form extensions.
View
12 src/Symfony/Component/Form/FormTypeGuesserChain.php
@@ -73,18 +73,6 @@ public function guessMaxLength($class, $property)
/**
* {@inheritDoc}
*/
- public function guessMinLength($class, $property)
- {
- trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED);
-
- return $this->guess(function ($guesser) use ($class, $property) {
- return $guesser->guessMinLength($class, $property);
- });
- }
-
- /**
- * {@inheritDoc}
- */
public function guessPattern($class, $property)
{
return $this->guess(function ($guesser) use ($class, $property) {
View
12 src/Symfony/Component/Form/FormTypeGuesserInterface.php
@@ -47,18 +47,6 @@ public function guessRequired($class, $property);
public function guessMaxLength($class, $property);
/**
- * Returns a guess about the field's minimum length
- *
- * @param string $class The fully qualified class name
- * @param string $property The name of the property to guess for
- *
- * @return Guess\Guess A guess for the field's minimum length
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function guessMinLength($class, $property);
-
- /**
* Returns a guess about the field's pattern
*
* - When you have a min value, you guess a min length of this min (LOW_CONFIDENCE) , lines below
View
28 src/Symfony/Component/Form/FormValidatorInterface.php
@@ -1,28 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Symfony\Component\Form;
-
-/**
- * This interface is deprecated. You should use a FormEvents::POST_BIND event
- * listener instead.
- *
- * @author Bernhard Schussek <bschussek@gmail.com>
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
-interface FormValidatorInterface
-{
- /**
- * @deprecated Deprecated since version 2.1, to be removed in 2.3.
- */
- public function validate(FormInterface $form);
-}
View
233 src/Symfony/Component/Form/FormView.php
@@ -54,124 +54,6 @@ public function __construct(FormView $parent = null)
}
/**
- * Returns the name of the form.
- *
- * @return string The form name.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead which contains an
- * entry named "name".
- */
- public function getName()
- {
- trigger_error('getName() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead which contains an entry named "name".', E_USER_DEPRECATED);
-
- return $this->vars['name'];
- }
-
- /**
- * @param string $name
- * @param mixed $value
- *
- * @return FormView The current view
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead.
- */
- public function set($name, $value)
- {
- trigger_error('set() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
-
- $this->vars[$name] = $value;
-
- return $this;
- }
-
- /**
- * @param $name
- *
- * @return Boolean
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead.
- */
- public function has($name)
- {
- trigger_error('has() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
-
- return array_key_exists($name, $this->vars);
- }
-
- /**
- * @param $name
- * @param $default
- *
- * @return mixed
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead.
- */
- public function get($name, $default = null)
- {
- trigger_error('get() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
-
- if (false === $this->has($name)) {
- return $default;
- }
-
- return $this->vars[$name];
- }
-
- /**
- * @return array
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead.
- */
- public function all()
- {
- trigger_error('all() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
-
- return $this->vars;
- }
-
- /**
- * Returns the values of all view variables.
- *
- * @return array The values of all variables.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead.
- */
- public function getVars()
- {
- trigger_error('getVars() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead.', E_USER_DEPRECATED);
-
- return $this->vars;
- }
-
- /**
- * Sets the value for an attribute.
- *
- * @param string $name The name of the attribute
- * @param string $value The value
- *
- * @return FormView The current view
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link vars} instead which contains an
- * entry named "attr".
- */
- public function setAttribute($name, $value)
- {
- trigger_error('setAttribute() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'vars\' instead which contains an entry named "attr".', E_USER_DEPRECATED);
-
- $this->vars['attr'][$name] = $value;
-
- return $this;
- }
-
- /**
* Returns whether the view was already rendered.
*
* @return Boolean Whether this view's widget is rendered.
@@ -210,121 +92,6 @@ public function setRendered()
}
/**
- * Sets the parent view.
- *
- * @param FormView $parent The parent view.
- *
- * @return FormView The view object.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link parent} instead.
- */
- public function setParent(FormView $parent = null)
- {
- trigger_error('setParent() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'parent\' instead.', E_USER_DEPRECATED);
-
- $this->parent = $parent;
-
- return $this;
- }
-
- /**
- * Returns the parent view.
- *
- * @return FormView The parent view.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link parent} instead.
- */
- public function getParent()
- {
- trigger_error('getParent() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'parent\' instead.', E_USER_DEPRECATED);
-
- return $this->parent;
- }
-
- /**
- * Returns whether this view has a parent.
- *
- * @return Boolean Whether this view has a parent
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link parent} instead.
- */
- public function hasParent()
- {
- trigger_error('hasParent() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'parent\' instead.', E_USER_DEPRECATED);
-
- return null !== $this->parent;
- }
-
- /**
- * Sets the children view.
- *
- * @param array $children The children as instances of FormView
- *
- * @return FormView The current view
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link children} instead.
- */
- public function setChildren(array $children)
- {
- trigger_error('setChildren() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'children\' instead.', E_USER_DEPRECATED);
-
- $this->children = $children;
-
- return $this;
- }
-
- /**
- * Returns the children.
- *
- * @return array The children as instances of FormView
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link children} instead.
- */
- public function getChildren()
- {
- trigger_error('getChildren() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'children\' instead.', E_USER_DEPRECATED);
-
- return $this->children;
- }
-
- /**
- * Returns a given child.
- *
- * @param string $name The name of the child
- *
- * @return FormView The child view
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Access
- * the public property {@link children} instead.
- */
- public function getChild($name)
- {
- trigger_error('getChild() is deprecated since version 2.1 and will be removed in 2.3. Access the public property \'children\' instead.', E_USER_DEPRECATED);
-
- return $this->children[$name];
- }
-
- /**
- * Returns whether this view has any children.
- *
- * @return Boolean Whether the view has children.
- *
- * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
- * {@link count()} instead.
- */
- public function hasChildren()
- {
- trigger_error('hasChildren() is deprecated since version 2.1 and will be removed in 2.3. Use count() instead.', E_USER_DEPRECATED);
-
- return count($this->children) > 0;
- }
-
- /**
* Returns a child by name (implements \ArrayAccess).
*
* @param string $name The child name
View
8 src/Symfony/Component/Form/ResolvedFormType.php
@@ -59,14 +59,6 @@ public function __construct(FormTypeInterface $innerType, array $typeExtensions
}
}
- // BC
- if ($innerType instanceof AbstractType) {
- /* @var AbstractType $innerType */
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handleBC'));
- $innerType->setExtensions($typeExtensions);
- restore_error_handler();
- }
-
$this->innerType = $innerType;
$this->typeExtensions = $typeExtensions;
$this->parent = $parent;
View
16 src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -114,22 +114,6 @@ public function testNotValidIfChildNotValid()
$this->assertFalse($this->form->isValid());
}
- public function testHasChildren()
- {
- $this->form->add($this->getBuilder()->getForm());
-
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
- $this->assertTrue($this->form->hasChildren());
- restore_error_handler();
- }
-
- public function testHasNoChildren()
- {
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
- $this->assertFalse($this->form->hasChildren());
- restore_error_handler();
- }
-
public function testAdd()
{
$child = $this->getBuilder('foo')->getForm();
View
13 src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -598,19 +598,6 @@ public function testPropertyPathNullImpliesDefault()
$this->assertTrue($form->getConfig()->getMapped());
}
- // BC
- public function testPropertyPathFalseImpliesDefaultNotMapped()
- {
- set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
- $form = $this->factory->createNamed('name', 'form', null, array(
- 'property_path' => false,
- ));
- restore_error_handler();
-
- $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
- $this->assertFalse($form->getConfig()->getMapped());
- }
-
public function testNotMapped()
{
$form = $this->factory->create('form', null, array(