diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php index 2e092a3a94..ebe4ccc920 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php @@ -143,6 +143,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface */ public function guessMinLength($class, $property) { + trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED); } /** diff --git a/src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php b/src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php index 4ee475ea2f..e6df5e1d89 100644 --- a/src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php +++ b/src/Symfony/Bridge/Propel1/Form/PropelTypeGuesser.php @@ -126,6 +126,7 @@ class PropelTypeGuesser implements FormTypeGuesserInterface */ public function guessMinLength($class, $property) { + trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED); } /** diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php index 479ceac511..ec45e824e0 100644 --- a/src/Symfony/Component/Form/AbstractType.php +++ b/src/Symfony/Component/Form/AbstractType.php @@ -67,6 +67,8 @@ abstract class AbstractType implements FormTypeInterface */ public function getDefaultOptions(array $options) { + trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED); + return array(); } @@ -82,6 +84,8 @@ abstract class AbstractType implements FormTypeInterface */ public function getAllowedOptionValues(array $options) { + trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED); + return array(); } @@ -104,6 +108,8 @@ abstract class AbstractType implements FormTypeInterface */ 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; } @@ -117,6 +123,8 @@ abstract class AbstractType implements FormTypeInterface */ 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; } } diff --git a/src/Symfony/Component/Form/AbstractTypeExtension.php b/src/Symfony/Component/Form/AbstractTypeExtension.php index 080b546b2d..c5dcfb94eb 100644 --- a/src/Symfony/Component/Form/AbstractTypeExtension.php +++ b/src/Symfony/Component/Form/AbstractTypeExtension.php @@ -58,6 +58,8 @@ abstract class AbstractTypeExtension implements FormTypeExtensionInterface */ public function getDefaultOptions() { + trigger_error('getDefaultOptions() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED); + return array(); } @@ -71,6 +73,8 @@ abstract class AbstractTypeExtension implements FormTypeExtensionInterface */ public function getAllowedOptionValues() { + trigger_error('getAllowedOptionValues() is deprecated since version 2.1 and will be removed in 2.3. Use setDefaultOptions() instead.', E_USER_DEPRECATED); + return array(); } } diff --git a/src/Symfony/Component/Form/CallbackValidator.php b/src/Symfony/Component/Form/CallbackValidator.php index 6d677c11f0..0e7c8012eb 100644 --- a/src/Symfony/Component/Form/CallbackValidator.php +++ b/src/Symfony/Component/Form/CallbackValidator.php @@ -27,6 +27,8 @@ class CallbackValidator implements FormValidatorInterface */ public function __construct($callback) { + trigger_error('CallbackValidator is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED); + $this->callback = $callback; } @@ -35,6 +37,8 @@ class CallbackValidator implements FormValidatorInterface */ 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); } } diff --git a/src/Symfony/Component/Form/Event/DataEvent.php b/src/Symfony/Component/Form/Event/DataEvent.php index 1091b5ccf2..cc7c3b2e7e 100644 --- a/src/Symfony/Component/Form/Event/DataEvent.php +++ b/src/Symfony/Component/Form/Event/DataEvent.php @@ -33,6 +33,8 @@ class DataEvent extends Event */ public function __construct(FormInterface $form, $data) { + trigger_error('DataEvent is deprecated since version 2.1 and will be removed in 2.3. Code against \Symfony\Component\Form\FormEvent instead.', E_USER_DEPRECATED); + $this->form = $form; $this->data = $data; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FieldType.php b/src/Symfony/Component/Form/Extension/Core/Type/FieldType.php index dbafde1f65..e5da968ca1 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/FieldType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/FieldType.php @@ -22,6 +22,11 @@ use Symfony\Component\Form\AbstractType; */ class FieldType extends AbstractType { + function __construct() + { + trigger_error('FieldType is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED); + } + /** * {@inheritdoc} */ diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index 6aa2da1122..ad89971ce3 100755 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -70,6 +70,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface */ public function guessMinLength($class, $property) { + trigger_error('guessMinLength() is deprecated since version 2.1 and will be removed in 2.3.', E_USER_DEPRECATED); } /** diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 6fbb1d5beb..ed6cea4e00 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -210,6 +210,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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()) { @@ -279,6 +281,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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; } @@ -310,6 +314,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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); } @@ -325,6 +331,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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); } @@ -470,6 +478,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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(); } @@ -627,6 +637,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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); } @@ -654,6 +666,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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(); } @@ -721,6 +735,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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; } @@ -770,6 +786,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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(); } @@ -783,6 +801,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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(); } @@ -804,6 +824,8 @@ class Form implements \IteratorAggregate, FormInterface */ public function getChildren() { + trigger_error('getChilren() is deprecated since version 2.1 and will be removed in 2.3. Use all() instead.', E_USER_DEPRECATED); + return $this->all(); } @@ -817,6 +839,8 @@ class Form implements \IteratorAggregate, FormInterface */ 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; } diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 1f8d713ddb..86e5587eff 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -295,6 +295,8 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB */ 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->getType(); null !== $type; $type = $type->getParent()) { diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index 9a21df4642..529fb89179 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -196,6 +196,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -251,6 +253,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -271,6 +275,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -290,6 +296,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -342,6 +350,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -363,6 +373,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -382,6 +394,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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 FormException('The config builder cannot be modified anymore.'); } @@ -471,6 +485,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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(); } @@ -492,6 +508,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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(); } @@ -508,6 +526,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface */ 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; } diff --git a/src/Symfony/Component/Form/FormFactory.php b/src/Symfony/Component/Form/FormFactory.php index 2d06e59be4..ce60e7d42f 100644 --- a/src/Symfony/Component/Form/FormFactory.php +++ b/src/Symfony/Component/Form/FormFactory.php @@ -146,6 +146,8 @@ class FormFactory implements FormFactoryInterface */ 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); } @@ -160,6 +162,8 @@ class FormFactory implements FormFactoryInterface */ 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( @@ -185,6 +189,8 @@ class FormFactory implements FormFactoryInterface */ 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(); } diff --git a/src/Symfony/Component/Form/FormRegistry.php b/src/Symfony/Component/Form/FormRegistry.php index 73de7875f6..24df9a8053 100644 --- a/src/Symfony/Component/Form/FormRegistry.php +++ b/src/Symfony/Component/Form/FormRegistry.php @@ -68,6 +68,8 @@ class FormRegistry implements FormRegistryInterface */ 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; } diff --git a/src/Symfony/Component/Form/FormTypeGuesserChain.php b/src/Symfony/Component/Form/FormTypeGuesserChain.php index 608709de87..5890e5b246 100644 --- a/src/Symfony/Component/Form/FormTypeGuesserChain.php +++ b/src/Symfony/Component/Form/FormTypeGuesserChain.php @@ -75,6 +75,8 @@ class FormTypeGuesserChain implements FormTypeGuesserInterface */ 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); }); diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php index 84eb19843c..b230d9c063 100644 --- a/src/Symfony/Component/Form/FormView.php +++ b/src/Symfony/Component/Form/FormView.php @@ -64,6 +64,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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']; } @@ -78,6 +79,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; @@ -93,6 +96,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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); } @@ -107,6 +112,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; } @@ -122,6 +129,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; } @@ -135,6 +144,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; } @@ -152,6 +163,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; @@ -207,6 +220,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; @@ -222,6 +237,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; } @@ -235,6 +252,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; } @@ -250,6 +269,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; @@ -265,6 +286,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; } @@ -280,6 +303,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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]; } @@ -293,6 +318,8 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable */ 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; }