[Form] removed deprecated methods and classes
This commit is contained in:
parent
e0385a2c1c
commit
b3081e85a0
@ -138,14 +138,6 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -129,14 +129,6 @@ class PropelTypeGuesser implements FormTypeGuesserInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -18,13 +18,6 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
*/
|
||||
abstract class AbstractType implements FormTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
|
||||
*/
|
||||
private $extensions = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -51,50 +44,6 @@ abstract class AbstractType implements FormTypeInterface
|
||||
*/
|
||||
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 @@ abstract class AbstractType implements FormTypeInterface
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -44,45 +44,5 @@ abstract class AbstractTypeExtension implements FormTypeExtensionInterface
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
}
|
@ -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(),
|
||||
|
@ -57,14 +57,6 @@ class CheckboxType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -211,14 +211,6 @@ class ChoiceType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -284,14 +284,6 @@ class DateTimeType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -247,14 +247,6 @@ class DateType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -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';
|
||||
}
|
||||
}
|
@ -51,14 +51,6 @@ class FileType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -45,8 +45,7 @@ class FormType extends AbstractType
|
||||
->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 @@ class FormType extends AbstractType
|
||||
->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 @@ class FormType extends AbstractType
|
||||
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 @@ class FormType extends AbstractType
|
||||
'max_length' => null,
|
||||
'pattern' => null,
|
||||
'property_path' => null,
|
||||
'mapped' => $mapped,
|
||||
'mapped' => true,
|
||||
'by_reference' => true,
|
||||
'error_bubbling' => $errorBubbling,
|
||||
'label' => null,
|
||||
|
@ -30,14 +30,6 @@ class HiddenType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -58,14 +58,6 @@ class IntegerType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -59,14 +59,6 @@ class MoneyType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -56,14 +56,6 @@ class NumberType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -45,14 +45,6 @@ class PercentType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -26,14 +26,6 @@ class TextType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -228,14 +228,6 @@ class TimeType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'field';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -53,11 +53,6 @@ class FormTypeValidatorExtension extends AbstractTypeExtension
|
||||
*/
|
||||
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 @@ class FormTypeValidatorExtension extends AbstractTypeExtension
|
||||
$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(),
|
||||
|
@ -65,14 +65,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -16,7 +16,6 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -201,27 +200,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return new PropertyPath($this->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -272,21 +250,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -303,40 +266,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return null === $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -366,14 +295,9 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$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();
|
||||
}
|
||||
|
||||
@ -472,21 +396,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return $this->viewData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -532,14 +441,9 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$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 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
|
||||
// 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,41 +522,9 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
$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}
|
||||
*/
|
||||
@ -672,21 +539,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -745,21 +597,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -796,36 +633,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -834,36 +641,6 @@ class Form implements \IteratorAggregate, FormInterface
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
|
@ -288,34 +288,6 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
||||
return new \ArrayIterator($this->children);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -84,42 +84,4 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
|
||||
* @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();
|
||||
}
|
||||
|
@ -195,22 +195,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
@ -243,72 +227,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -341,72 +259,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -479,21 +331,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this->viewTransformers;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -502,21 +339,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this->modelTransformers;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
@ -525,16 +347,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
||||
return $this->dataMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -40,17 +40,6 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -104,15 +104,6 @@ interface FormConfigInterface
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -26,24 +26,6 @@ final class FormEvents
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
|
@ -98,20 +98,14 @@ class FormFactory implements FormFactoryInterface
|
||||
|
||||
$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 @@ class FormFactory implements FormFactoryInterface
|
||||
$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);
|
||||
}
|
||||
@ -136,66 +126,6 @@ class FormFactory implements FormFactoryInterface
|
||||
return $this->createNamedBuilder($property, $type, $data, $options, $parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
@ -64,16 +64,6 @@ class FormRegistry implements FormRegistryInterface
|
||||
$this->resolvedTypeFactory = $resolvedTypeFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
@ -132,13 +122,11 @@ class FormRegistry implements FormRegistryInterface
|
||||
);
|
||||
}
|
||||
|
||||
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();
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,17 +18,6 @@ namespace Symfony\Component\Form;
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
@ -70,18 +70,6 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -46,18 +46,6 @@ interface FormTypeGuesserInterface
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
@ -53,124 +53,6 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -209,121 +91,6 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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).
|
||||
*
|
||||
|
@ -59,14 +59,6 @@ class ResolvedFormType implements ResolvedFormTypeInterface
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
@ -114,22 +114,6 @@ class CompoundFormTest extends AbstractFormTest
|
||||
$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();
|
||||
|
@ -598,19 +598,6 @@ class FormTypeTest extends TypeTestCase
|
||||
$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(
|
||||
|
@ -71,56 +71,6 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
))));
|
||||
}
|
||||
|
||||
public function testAddType()
|
||||
{
|
||||
$type = new FooType();
|
||||
$resolvedType = $this->getMockResolvedType();
|
||||
|
||||
$this->resolvedTypeFactory->expects($this->once())
|
||||
->method('createResolvedType')
|
||||
->with($type)
|
||||
->will($this->returnValue($resolvedType));
|
||||
|
||||
$this->registry->expects($this->once())
|
||||
->method('addType')
|
||||
->with($resolvedType);
|
||||
|
||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||
$this->factory->addType($type);
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
public function testHasType()
|
||||
{
|
||||
$this->registry->expects($this->once())
|
||||
->method('hasType')
|
||||
->with('name')
|
||||
->will($this->returnValue('RESULT'));
|
||||
|
||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||
$this->assertSame('RESULT', $this->factory->hasType('name'));
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
public function testGetType()
|
||||
{
|
||||
$type = new FooType();
|
||||
$resolvedType = $this->getMockResolvedType();
|
||||
|
||||
$resolvedType->expects($this->once())
|
||||
->method('getInnerType')
|
||||
->will($this->returnValue($type));
|
||||
|
||||
$this->registry->expects($this->once())
|
||||
->method('getType')
|
||||
->with('name')
|
||||
->will($this->returnValue($resolvedType));
|
||||
|
||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||
$this->assertEquals($type, $this->factory->getType('name'));
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
public function testCreateNamedBuilderWithTypeName()
|
||||
{
|
||||
$options = array('a' => '1', 'b' => '2');
|
||||
@ -484,74 +434,6 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('builderInstance', $builder);
|
||||
}
|
||||
|
||||
public function testCreateBuilderUsesMinLengthIfFound()
|
||||
{
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessMinLength')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
2,
|
||||
Guess::MEDIUM_CONFIDENCE
|
||||
)));
|
||||
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessMinLength')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
5,
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
|
||||
$factory = $this->getMockFactory(array('createNamedBuilder'));
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'text', null, array('pattern' => '.{5,}'))
|
||||
->will($this->returnValue('builderInstance'));
|
||||
|
||||
$builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
'firstName'
|
||||
);
|
||||
|
||||
$this->assertEquals('builderInstance', $builder);
|
||||
}
|
||||
|
||||
public function testCreateBuilderPrefersPatternOverMinLength()
|
||||
{
|
||||
// min length is deprecated
|
||||
$this->guesser1->expects($this->once())
|
||||
->method('guessMinLength')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
2,
|
||||
Guess::HIGH_CONFIDENCE
|
||||
)));
|
||||
|
||||
// pattern is preferred even though confidence is lower
|
||||
$this->guesser2->expects($this->once())
|
||||
->method('guessPattern')
|
||||
->with('Application\Author', 'firstName')
|
||||
->will($this->returnValue(new ValueGuess(
|
||||
'.{5,10}',
|
||||
Guess::LOW_CONFIDENCE
|
||||
)));
|
||||
|
||||
$factory = $this->getMockFactory(array('createNamedBuilder'));
|
||||
|
||||
$factory->expects($this->once())
|
||||
->method('createNamedBuilder')
|
||||
->with('firstName', 'text', null, array('pattern' => '.{5,10}'))
|
||||
->will($this->returnValue('builderInstance'));
|
||||
|
||||
$builder = $factory->createBuilderForProperty(
|
||||
'Application\Author',
|
||||
'firstName'
|
||||
);
|
||||
|
||||
$this->assertEquals('builderInstance', $builder);
|
||||
}
|
||||
|
||||
public function testCreateBuilderUsesRequiredSettingWithHighestConfidence()
|
||||
{
|
||||
$this->guesser1->expects($this->once())
|
||||
|
@ -68,21 +68,6 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase
|
||||
), $this->resolvedTypeFactory);
|
||||
}
|
||||
|
||||
public function testGetTypeReturnsAddedType()
|
||||
{
|
||||
$resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
|
||||
|
||||
$resolvedType->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue('foo'));
|
||||
|
||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||
$this->registry->addType($resolvedType);
|
||||
restore_error_handler();
|
||||
|
||||
$this->assertSame($resolvedType, $this->registry->getType('foo'));
|
||||
}
|
||||
|
||||
public function testGetTypeFromExtension()
|
||||
{
|
||||
$type = new FooType();
|
||||
@ -215,23 +200,6 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase
|
||||
$this->registry->getType(array());
|
||||
}
|
||||
|
||||
public function testHasTypeAfterAdding()
|
||||
{
|
||||
$resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
|
||||
|
||||
$resolvedType->expects($this->any())
|
||||
->method('getName')
|
||||
->will($this->returnValue('foo'));
|
||||
|
||||
$this->assertFalse($this->registry->hasType('foo'));
|
||||
|
||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||
$this->registry->addType($resolvedType);
|
||||
restore_error_handler();
|
||||
|
||||
$this->assertTrue($this->registry->hasType('foo'));
|
||||
}
|
||||
|
||||
public function testHasTypeAfterLoadingFromExtension()
|
||||
{
|
||||
$type = new FooType();
|
||||
|
@ -640,27 +640,6 @@ class SimpleFormTest extends AbstractFormTest
|
||||
$this->assertEquals('bar', $form->getData());
|
||||
}
|
||||
|
||||
public function testBindValidatesAfterTransformation()
|
||||
{
|
||||
$test = $this;
|
||||
$validator = $this->getFormValidator();
|
||||
set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
|
||||
$form = $this->getBuilder()
|
||||
->addValidator($validator)
|
||||
->getForm();
|
||||
|
||||
$validator->expects($this->once())
|
||||
->method('validate')
|
||||
->with($form)
|
||||
->will($this->returnCallback(function ($form) use ($test) {
|
||||
$test->assertEquals('foobar', $form->getData());
|
||||
}));
|
||||
|
||||
$form->bind('foobar');
|
||||
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
public function testBindResetsErrors()
|
||||
{
|
||||
$this->form->addError(new FormError('Error!'));
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Form\Util;
|
||||
|
||||
use Symfony\Component\PropertyAccess\StringUtil;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
@ -23,19 +21,6 @@ class FormUtil
|
||||
*/
|
||||
private function __construct() {}
|
||||
|
||||
/**
|
||||
* Alias for {@link StringUtil::singularify()}
|
||||
*
|
||||
* @deprecated Deprecated since version 2.2, to be removed in 2.3. Use
|
||||
* {@link StringUtil::singularify()} instead.
|
||||
*/
|
||||
public static function singularify($plural)
|
||||
{
|
||||
trigger_error('\Symfony\Component\Form\Util\FormUtil::singularify() is deprecated since version 2.2 and will be removed in 2.3. Use \Symfony\Component\PropertyAccess\StringUtil::singularify() in the PropertyAccess component instead.', E_USER_DEPRECATED);
|
||||
|
||||
return StringUtil::singularify($plural);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given data is empty.
|
||||
*
|
||||
|
@ -1,57 +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\Util;
|
||||
|
||||
use Symfony\Component\PropertyAccess\PropertyPath as BasePropertyPath;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccess;
|
||||
|
||||
/**
|
||||
* Alias for {@link \Symfony\Component\PropertyAccess\PropertyPath}.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated deprecated since version 2.2, to be removed in 2.3. Use
|
||||
* {@link \Symfony\Component\PropertyAccess\PropertyPath}
|
||||
* instead.
|
||||
*/
|
||||
class PropertyPath extends BasePropertyPath
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($propertyPath)
|
||||
{
|
||||
parent::__construct($propertyPath);
|
||||
|
||||
trigger_error('\Symfony\Component\Form\Util\PropertyPath is deprecated since version 2.2 and will be removed in 2.3. Use \Symfony\Component\PropertyAccess\PropertyPath instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for {@link PropertyAccessor::getValue()}
|
||||
*/
|
||||
public function getValue($objectOrArray)
|
||||
{
|
||||
$propertyAccessor = PropertyAccess::getPropertyAccessor();
|
||||
|
||||
return $propertyAccessor->getValue($objectOrArray, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for {@link PropertyAccessor::setValue()}
|
||||
*/
|
||||
public function setValue(&$objectOrArray, $value)
|
||||
{
|
||||
$propertyAccessor = PropertyAccess::getPropertyAccessor();
|
||||
|
||||
return $propertyAccessor->setValue($objectOrArray, $this, $value);
|
||||
}
|
||||
}
|
@ -1,36 +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\Util;
|
||||
|
||||
use Symfony\Component\PropertyAccess\PropertyPathBuilder as BasePropertyPathBuilder;
|
||||
|
||||
/**
|
||||
* Alias for {@link \Symfony\Component\PropertyAccess\PropertyPathBuilder}.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated deprecated since version 2.2, to be removed in 2.3. Use
|
||||
* {@link \Symfony\Component\PropertyAccess\PropertyPathBuilder}
|
||||
* instead.
|
||||
*/
|
||||
class PropertyPathBuilder extends BasePropertyPathBuilder
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($propertyPath)
|
||||
{
|
||||
parent::__construct($propertyPath);
|
||||
|
||||
trigger_error('\Symfony\Component\Form\Util\PropertyPathBuilder is deprecated since version 2.2 and will be removed in 2.3. Use \Symfony\Component\PropertyAccess\PropertyPathBuilder instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
@ -1,27 +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\Util;
|
||||
|
||||
use Symfony\Component\PropertyAccess\PropertyPathInterface as BasePropertyPathInterface;
|
||||
|
||||
/**
|
||||
* Alias for {@link \Symfony\Component\PropertyAccess\PropertyPathInterface}.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated deprecated since version 2.2, to be removed in 2.3. Use
|
||||
* {@link \Symfony\Component\PropertyAccess\PropertyPathInterface}
|
||||
* instead.
|
||||
*/
|
||||
interface PropertyPathInterface extends BasePropertyPathInterface
|
||||
{
|
||||
}
|
@ -1,36 +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\Util;
|
||||
|
||||
use Symfony\Component\PropertyAccess\PropertyPathIterator as BasePropertyPathIterator;
|
||||
|
||||
/**
|
||||
* Alias for {@link \Symfony\Component\PropertyAccess\PropertyPathIterator}.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated deprecated since version 2.2, to be removed in 2.3. Use
|
||||
* {@link \Symfony\Component\PropertyAccess\PropertyPathIterator}
|
||||
* instead.
|
||||
*/
|
||||
class PropertyPathIterator extends BasePropertyPathIterator
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($propertyPath)
|
||||
{
|
||||
parent::__construct($propertyPath);
|
||||
|
||||
trigger_error('\Symfony\Component\Form\Util\PropertyPathIterator is deprecated since version 2.2 and will be removed in 2.3. Use \Symfony\Component\PropertyAccess\PropertyPathIterator instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
@ -1,27 +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\Util;
|
||||
|
||||
use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface as BasePropertyPathIteratorInterface;
|
||||
|
||||
/**
|
||||
* Alias for {@link \Symfony\Component\PropertyAccess\PropertyPathIteratorInterface}.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @deprecated deprecated since version 2.2, to be removed in 2.3. Use
|
||||
* {@link \Symfony\Component\PropertyAccess\PropertyPathIterator}
|
||||
* instead.
|
||||
*/
|
||||
interface PropertyPathIteratorInterface extends BasePropertyPathIteratorInterface
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user