code
stringlengths
2.5k
150k
kind
stringclasses
1 value
symfony FormTypeExtensionInterface FormTypeExtensionInterface =========================== interface **FormTypeExtensionInterface** Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | | | | [finishView](#method_finishView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | #### See also | | | | --- | --- | | [FormTypeInterface::buildForm](formtypeinterface#method_buildForm "Symfony\Component\Form\FormTypeInterface") | | ### buildView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | #### See also | | | | --- | --- | | [FormTypeInterface::buildView](formtypeinterface#method_buildView "Symfony\Component\Form\FormTypeInterface") | | ### finishView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | #### See also | | | | --- | --- | | [FormTypeInterface::finishView](formtypeinterface#method_finishView "Symfony\Component\Form\FormTypeInterface") | | ### configureOptions([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended | symfony Symfony\Component\Form\Guess Symfony\Component\Form\Guess ============================ Classes ------- | | | | --- | --- | | [Guess](guess/guess "Symfony\Component\Form\Guess\Guess") | Base class for guesses made by TypeGuesserInterface implementation. | | [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess") | Contains a guessed class name and a list of options for creating an instance of that class. | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | Contains a guessed value. | symfony Symfony\Component\Form\Util Symfony\Component\Form\Util =========================== Classes ------- | | | | --- | --- | | [FormUtil](util/formutil "Symfony\Component\Form\Util\FormUtil") | | | [InheritDataAwareIterator](util/inheritdataawareiterator "Symfony\Component\Form\Util\InheritDataAwareIterator") | Iterator that traverses an array of forms. | | [OptionsResolverWrapper](util/optionsresolverwrapper "Symfony\Component\Form\Util\OptionsResolverWrapper") | | | [OrderedHashMap](util/orderedhashmap "Symfony\Component\Form\Util\OrderedHashMap") | A hash map which keeps track of deletions and additions. | | [OrderedHashMapIterator](util/orderedhashmapiterator "Symfony\Component\Form\Util\OrderedHashMapIterator") | Iterator for {@link OrderedHashMap} objects. | | [ServerParams](util/serverparams "Symfony\Component\Form\Util\ServerParams") | | | [StringUtil](util/stringutil "Symfony\Component\Form\Util\StringUtil") | | symfony Symfony\Component\Form\Exception Symfony\Component\Form\Exception ================================ Classes ------- | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | Thrown when an operation is called that is not acceptable after submitting a form. | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | Base BadMethodCallException for the Form component. | | [ErrorMappingException](exception/errormappingexception "Symfony\Component\Form\Exception\ErrorMappingException") | | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | Base InvalidArgumentException for the Form component. | | [InvalidConfigurationException](exception/invalidconfigurationexception "Symfony\Component\Form\Exception\InvalidConfigurationException") | | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | Base LogicException for Form component. | | [OutOfBoundsException](exception/outofboundsexception "Symfony\Component\Form\Exception\OutOfBoundsException") | Base OutOfBoundsException for Form component. | | [RuntimeException](exception/runtimeexception "Symfony\Component\Form\Exception\RuntimeException") | Base RuntimeException for the Form component. | | [StringCastException](exception/stringcastexception "Symfony\Component\Form\Exception\StringCastException") | | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | Indicates a value transformation error. | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | | Interfaces ---------- | | | | --- | --- | | *[ExceptionInterface](exception/exceptioninterface "Symfony\Component\Form\Exception\ExceptionInterface")* | Base ExceptionInterface for the Form component. | symfony AbstractTypeExtension AbstractTypeExtension ====================== abstract class **AbstractTypeExtension** implements [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | | | | [finishView](#method_finishView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | Details ------- ### buildForm([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | symfony CallbackTransformer CallbackTransformer ==================== class **CallbackTransformer** implements [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(callable $transform, callable $reverseTransform) | | | mixed | [transform](#method_transform)(mixed $data) Transforms a value from the original representation to a transformed representation. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $data) Transforms a value from the transformed representation to its original representation. | | Details ------- ### \_\_construct(callable $transform, callable $reverseTransform) #### Parameters | | | | | --- | --- | --- | | callable | $transform | The forward transform callback | | callable | $reverseTransform | The reverse transform callback | ### mixed transform(mixed $data) Transforms a value from the original representation to a transformed representation. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | when the argument is not of the expected type | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | ### mixed reverseTransform(mixed $data) Transforms a value from the transformed representation to its original representation. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | when the argument is not of the expected type | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | symfony DataMapperInterface DataMapperInterface ==================== interface **DataMapperInterface** Methods ------- | | | | | --- | --- | --- | | | [mapDataToForms](#method_mapDataToForms)(mixed $data, [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms) Maps properties of some data to a list of forms. | | | | [mapFormsToData](#method_mapFormsToData)([FormInterface](forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms, mixed $data) Maps the data of a list of forms into the properties of some data. | | Details ------- ### mapDataToForms(mixed $data, [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms) Maps properties of some data to a list of forms. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Structured data | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) | $forms | A list of {@link FormInterface} instances | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | ### mapFormsToData([FormInterface](forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms, mixed $data) Maps the data of a list of forms into the properties of some data. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) | $forms | A list of {@link FormInterface} instances | | mixed | $data | Structured data | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | symfony FormInterface FormInterface ============== interface **FormInterface** implements [ArrayAccess](http://php.net/ArrayAccess), [Traversable](http://php.net/Traversable), [Countable](http://php.net/Countable) A form group bundling multiple forms in a hierarchical structure. Methods ------- | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [setParent](#method_setParent)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null | [getParent](#method_getParent)() Returns the parent form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [add](#method_add)([FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Adds or replaces a child to the form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [get](#method_get)(string $name) Returns the child with the given name. | | | bool | [has](#method_has)(string $name) Returns whether a child with the given name exists. | | | $this | [remove](#method_remove)(string $name) Removes a child from the form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] | [all](#method_all)() Returns all children in this group. | | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | [getErrors](#method_getErrors)(bool $deep = false, bool $flatten = true) Returns the errors of this form. | | | $this | [setData](#method_setData)(mixed $modelData) Updates the form with default data. | | | mixed | [getData](#method_getData)() Returns the data in the format needed for the underlying object. | | | mixed | [getNormData](#method_getNormData)() Returns the normalized data of the field. | | | mixed | [getViewData](#method_getViewData)() Returns the data transformed by the value transformer. | | | array | [getExtraData](#method_getExtraData)() Returns the extra data. | | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getConfig](#method_getConfig)() Returns the form's configuration. | | | bool | [isSubmitted](#method_isSubmitted)() Returns whether the form is submitted. | | | string | [getName](#method_getName)() Returns the name by which the form is identified in forms. | | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form is mapped to. | | | $this | [addError](#method_addError)([FormError](formerror "Symfony\Component\Form\FormError") $error) Adds an error to this form. | | | bool | [isValid](#method_isValid)() Returns whether the form and all children are valid. | | | bool | [isRequired](#method_isRequired)() Returns whether the form is required to be filled out. | | | bool | [isDisabled](#method_isDisabled)() Returns whether this form is disabled. | | | bool | [isEmpty](#method_isEmpty)() Returns whether the form is empty. | | | bool | [isSynchronized](#method_isSynchronized)() Returns whether the data in the different formats is synchronized. | | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | [getTransformationFailure](#method_getTransformationFailure)() Returns the data transformation failure, if any. | | | $this | [initialize](#method_initialize)() Initializes the form tree. | | | $this | [handleRequest](#method_handleRequest)(mixed $request = null) Inspects the given request and calls {@link submit()} if the form was submitted. | | | $this | [submit](#method_submit)(mixed $submittedData, bool $clearMissing = true) Submits data to the form, transforms and validates it. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getRoot](#method_getRoot)() Returns the root of the form tree. | | | bool | [isRoot](#method_isRoot)() Returns whether the field is the root of the form tree. | | | [FormView](formview "Symfony\Component\Form\FormView") | [createView](#method_createView)([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. | | Details ------- ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") setParent([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $parent | | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | when trying to set a parent for a form with an empty name | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null getParent() Returns the parent form. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null | The parent form or null if there is none | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") add([FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Adds or replaces a child to the form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int | $child | The FormInterface instance or the name of the child | | string|null | $type | The child's type, if a name was passed | | array | $options | The child's options, if a name was passed | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | when trying to add a child to a non-compound form | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if $child or $type has an unexpected type | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") get(string $name) Returns the child with the given name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](http://php.net/OutOfBoundsException) | if the named child does not exist | ### bool has(string $name) Returns whether a child with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | bool | | ### $this remove(string $name) Removes a child from the form. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child to remove | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] all() Returns all children in this group. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] | | ### [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") getErrors(bool $deep = false, bool $flatten = true) Returns the errors of this form. #### Parameters | | | | | --- | --- | --- | | bool | $deep | Whether to include errors of child forms as well | | bool | $flatten | Whether to flatten the list of errors in case $deep is set to true | #### Return Value | | | | --- | --- | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | An iterator over the {@link FormError} instances that where added to this form | ### $this setData(mixed $modelData) Updates the form with default data. #### Parameters | | | | | --- | --- | --- | | mixed | $modelData | The data formatted as expected for the underlying object | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | If listeners try to call setData in a cycle. Or if the view data does not match the expected type according to {@link FormConfigInterface::getDataClass}. | ### mixed getData() Returns the data in the format needed for the underlying object. #### Return Value | | | | --- | --- | | mixed | | ### mixed getNormData() Returns the normalized data of the field. #### Return Value | | | | --- | --- | | mixed | When the field is not submitted, the default data is returned. When the field is submitted, the normalized submitted data is returned if the field is valid, null otherwise. | ### mixed getViewData() Returns the data transformed by the value transformer. #### Return Value | | | | --- | --- | | mixed | | ### array getExtraData() Returns the extra data. #### Return Value | | | | --- | --- | | array | The submitted data which do not belong to a child | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getConfig() Returns the form's configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | The configuration | ### bool isSubmitted() Returns whether the form is submitted. #### Return Value | | | | --- | --- | | bool | true if the form is submitted, false otherwise | ### string getName() Returns the name by which the form is identified in forms. #### Return Value | | | | --- | --- | | string | The name of the form | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form is mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### $this addError([FormError](formerror "Symfony\Component\Form\FormError") $error) Adds an error to this form. #### Parameters | | | | | --- | --- | --- | | [FormError](formerror "Symfony\Component\Form\FormError") | $error | | #### Return Value | | | | --- | --- | | $this | | ### bool isValid() Returns whether the form and all children are valid. #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | if the form is not submitted | ### bool isRequired() Returns whether the form is required to be filled out. If the form has a parent and the parent is not required, this method will always return false. Otherwise the value set with setRequired() is returned. #### Return Value | | | | --- | --- | | bool | | ### bool isDisabled() Returns whether this form is disabled. The content of a disabled form is displayed, but not allowed to be modified. The validation of modified disabled forms should fail. Forms whose parents are disabled are considered disabled regardless of their own state. #### Return Value | | | | --- | --- | | bool | | ### bool isEmpty() Returns whether the form is empty. #### Return Value | | | | --- | --- | | bool | | ### bool isSynchronized() Returns whether the data in the different formats is synchronized. If the data is not synchronized, you can get the transformation failure by calling {@link getTransformationFailure()}. #### Return Value | | | | --- | --- | | bool | | ### [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null getTransformationFailure() Returns the data transformation failure, if any. #### Return Value | | | | --- | --- | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | The transformation failure | ### $this initialize() Initializes the form tree. Should be called on the root form after constructing the tree. #### Return Value | | | | --- | --- | | $this | | ### $this handleRequest(mixed $request = null) Inspects the given request and calls {@link submit()} if the form was submitted. Internally, the request is forwarded to the configured {@link RequestHandlerInterface} instance, which determines whether to submit the form or not. #### Parameters | | | | | --- | --- | --- | | mixed | $request | The request to handle | #### Return Value | | | | --- | --- | | $this | | ### $this submit(mixed $submittedData, bool $clearMissing = true) Submits data to the form, transforms and validates it. #### Parameters | | | | | --- | --- | --- | | mixed | $submittedData | The submitted data | | bool | $clearMissing | Whether to set fields to NULL when they are missing in the submitted data | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getRoot() Returns the root of the form tree. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The root of the tree | ### bool isRoot() Returns whether the field is the root of the form tree. #### Return Value | | | | --- | --- | | bool | | ### [FormView](formview "Symfony\Component\Form\FormView") createView([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $parent | | #### Return Value | | | | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | The view |
programming_docs
symfony ClickableInterface ClickableInterface =================== interface **ClickableInterface** A clickable form element. Methods ------- | | | | | --- | --- | --- | | bool | [isClicked](#method_isClicked)() Returns whether this element was clicked. | | Details ------- ### bool isClicked() Returns whether this element was clicked. #### Return Value | | | | --- | --- | | bool | Whether this element was clicked | symfony FormConfigBuilderInterface FormConfigBuilderInterface =========================== interface **FormConfigBuilderInterface** implements [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") Methods ------- | | | | | --- | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Returns the event dispatcher used to dispatch form events. | from [FormConfigInterface](formconfiginterface#method_getEventDispatcher "Symfony\Component\Form\FormConfigInterface") | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | from [FormConfigInterface](formconfiginterface#method_getName "Symfony\Component\Form\FormConfigInterface") | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form should be mapped to. | from [FormConfigInterface](formconfiginterface#method_getPropertyPath "Symfony\Component\Form\FormConfigInterface") | | bool | [getMapped](#method_getMapped)() Returns whether the form should be mapped to an element of its parent's data. | from [FormConfigInterface](formconfiginterface#method_getMapped "Symfony\Component\Form\FormConfigInterface") | | bool | [getByReference](#method_getByReference)() Returns whether the form's data should be modified by reference. | from [FormConfigInterface](formconfiginterface#method_getByReference "Symfony\Component\Form\FormConfigInterface") | | bool | [getInheritData](#method_getInheritData)() Returns whether the form should read and write the data of its parent. | from [FormConfigInterface](formconfiginterface#method_getInheritData "Symfony\Component\Form\FormConfigInterface") | | bool | [getCompound](#method_getCompound)() Returns whether the form is compound. | from [FormConfigInterface](formconfiginterface#method_getCompound "Symfony\Component\Form\FormConfigInterface") | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form types used to construct the form. | from [FormConfigInterface](formconfiginterface#method_getType "Symfony\Component\Form\FormConfigInterface") | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Returns the view transformers of the form. | from [FormConfigInterface](formconfiginterface#method_getViewTransformers "Symfony\Component\Form\FormConfigInterface") | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Returns the model transformers of the form. | from [FormConfigInterface](formconfiginterface#method_getModelTransformers "Symfony\Component\Form\FormConfigInterface") | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Returns the data mapper of the form. | from [FormConfigInterface](formconfiginterface#method_getDataMapper "Symfony\Component\Form\FormConfigInterface") | | bool | [getRequired](#method_getRequired)() Returns whether the form is required. | from [FormConfigInterface](formconfiginterface#method_getRequired "Symfony\Component\Form\FormConfigInterface") | | bool | [getDisabled](#method_getDisabled)() Returns whether the form is disabled. | from [FormConfigInterface](formconfiginterface#method_getDisabled "Symfony\Component\Form\FormConfigInterface") | | bool | [getErrorBubbling](#method_getErrorBubbling)() Returns whether errors attached to the form will bubble to its parent. | from [FormConfigInterface](formconfiginterface#method_getErrorBubbling "Symfony\Component\Form\FormConfigInterface") | | mixed | [getEmptyData](#method_getEmptyData)() Returns the data that should be returned when the form is empty. | from [FormConfigInterface](formconfiginterface#method_getEmptyData "Symfony\Component\Form\FormConfigInterface") | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the form. | from [FormConfigInterface](formconfiginterface#method_getAttributes "Symfony\Component\Form\FormConfigInterface") | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | from [FormConfigInterface](formconfiginterface#method_hasAttribute "Symfony\Component\Form\FormConfigInterface") | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | from [FormConfigInterface](formconfiginterface#method_getAttribute "Symfony\Component\Form\FormConfigInterface") | | mixed | [getData](#method_getData)() Returns the initial data of the form. | from [FormConfigInterface](formconfiginterface#method_getData "Symfony\Component\Form\FormConfigInterface") | | string|null | [getDataClass](#method_getDataClass)() Returns the class of the form data or null if the data is scalar or an array. | from [FormConfigInterface](formconfiginterface#method_getDataClass "Symfony\Component\Form\FormConfigInterface") | | bool | [getDataLocked](#method_getDataLocked)() Returns whether the form's data is locked. | from [FormConfigInterface](formconfiginterface#method_getDataLocked "Symfony\Component\Form\FormConfigInterface") | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Returns the form factory used for creating new forms. | from [FormConfigInterface](formconfiginterface#method_getFormFactory "Symfony\Component\Form\FormConfigInterface") | | string | [getAction](#method_getAction)() Returns the target URL of the form. | from [FormConfigInterface](formconfiginterface#method_getAction "Symfony\Component\Form\FormConfigInterface") | | string | [getMethod](#method_getMethod)() Returns the HTTP method used by the form. | from [FormConfigInterface](formconfiginterface#method_getMethod "Symfony\Component\Form\FormConfigInterface") | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Returns the request handler used by the form. | from [FormConfigInterface](formconfiginterface#method_getRequestHandler "Symfony\Component\Form\FormConfigInterface") | | bool | [getAutoInitialize](#method_getAutoInitialize)() Returns whether the form should be initialized upon creation. | from [FormConfigInterface](formconfiginterface#method_getAutoInitialize "Symfony\Component\Form\FormConfigInterface") | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the form. | from [FormConfigInterface](formconfiginterface#method_getOptions "Symfony\Component\Form\FormConfigInterface") | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | from [FormConfigInterface](formconfiginterface#method_hasOption "Symfony\Component\Form\FormConfigInterface") | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | from [FormConfigInterface](formconfiginterface#method_getOption "Symfony\Component\Form\FormConfigInterface") | | $this | [addEventListener](#method_addEventListener)(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. | | | $this | [addEventSubscriber](#method_addEventSubscriber)([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. | | | $this | [addViewTransformer](#method_addViewTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. | | | $this | [resetViewTransformers](#method_resetViewTransformers)() Clears the view transformers. | | | $this | [addModelTransformer](#method_addModelTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. | | | $this | [resetModelTransformers](#method_resetModelTransformers)() Clears the normalization transformers. | | | $this | [setAttribute](#method_setAttribute)(string $name, mixed $value) Sets the value for an attribute. | | | $this | [setAttributes](#method_setAttributes)(array $attributes) Sets the attributes. | | | $this | [setDataMapper](#method_setDataMapper)([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. | | | $this | [setDisabled](#method_setDisabled)(bool $disabled) Set whether the form is disabled. | | | $this | [setEmptyData](#method_setEmptyData)(mixed $emptyData) Sets the data used for the client data when no value is submitted. | | | $this | [setErrorBubbling](#method_setErrorBubbling)(bool $errorBubbling) Sets whether errors bubble up to the parent. | | | $this | [setRequired](#method_setRequired)(bool $required) Sets whether this field is required to be filled out when submitted. | | | $this | [setPropertyPath](#method_setPropertyPath)(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. | | | $this | [setMapped](#method_setMapped)(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. | | | $this | [setByReference](#method_setByReference)(bool $byReference) Sets whether the form's data should be modified by reference. | | | $this | [setInheritData](#method_setInheritData)(bool $inheritData) Sets whether the form should read and write the data of its parent. | | | $this | [setCompound](#method_setCompound)(bool $compound) Sets whether the form should be compound. | | | $this | [setType](#method_setType)([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. | | | $this | [setData](#method_setData)(mixed $data) Sets the initial data of the form. | | | $this | [setDataLocked](#method_setDataLocked)(bool $locked) Locks the form's data to the data passed in the configuration. | | | | [setFormFactory](#method_setFormFactory)([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. | | | $this | [setAction](#method_setAction)(string $action) Sets the target URL of the form. | | | $this | [setMethod](#method_setMethod)(string $method) Sets the HTTP method used by the form. | | | $this | [setRequestHandler](#method_setRequestHandler)([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. | | | $this | [setAutoInitialize](#method_setAutoInitialize)(bool $initialize) Sets whether the form should be initialized automatically. | | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getFormConfig](#method_getFormConfig)() Builds and returns the form configuration. | | Details ------- ### [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Returns the event dispatcher used to dispatch form events. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form should be mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Returns whether the form should be mapped to an element of its parent's data. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Returns whether the form's data should be modified by reference. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getInheritData() Returns whether the form should read and write the data of its parent. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### bool getCompound() Returns whether the form is compound. This property is independent of whether the form actually has children. A form can be compound and have no children at all, like for example an empty collection form. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form types used to construct the form. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Returns the view transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Returns the model transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Returns the data mapper of the form. #### Return Value | | | | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Returns whether the form is required. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the form is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Returns whether errors attached to the form will bubble to its parent. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Returns the data that should be returned when the form is empty. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the form. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Returns the initial data of the form. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Returns the class of the form data or null if the data is scalar or an array. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Returns whether the form's data is locked. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Returns the form factory used for creating new forms. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Returns the target URL of the form. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Returns the HTTP method used by the form. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Returns the request handler used by the form. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Returns whether the form should be initialized upon creation. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### array getOptions() Returns all options passed during the construction of the form. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value | ### $this addEventListener(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. #### Parameters | | | | | --- | --- | --- | | string | $eventName | The name of the event to listen to | | callable | $listener | The listener to execute | | int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addEventSubscriber([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. #### Parameters | | | | | --- | --- | --- | | [EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") | $subscriber | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addViewTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. The transform method of the transformer is used to convert data from the normalized to the view format. The reverseTransform method of the transformer is used to convert from the view to the normalized format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $viewTransformer | | | bool | $forcePrepend | If set to true, prepend instead of appending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetViewTransformers() Clears the view transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addModelTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. The transform method of the transformer is used to convert data from the model to the normalized format. The reverseTransform method of the transformer is used to convert from the normalized to the model format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $modelTransformer | | | bool | $forceAppend | If set to true, append instead of prepending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetModelTransformers() Clears the normalization transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttribute(string $name, mixed $value) Sets the value for an attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the attribute | | mixed | $value | The value of the attribute | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttributes(array $attributes) Sets the attributes. #### Parameters | | | | | --- | --- | --- | | array | $attributes | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataMapper([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. #### Parameters | | | | | --- | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") | $dataMapper | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDisabled(bool $disabled) Set whether the form is disabled. #### Parameters | | | | | --- | --- | --- | | bool | $disabled | Whether the form is disabled | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setEmptyData(mixed $emptyData) Sets the data used for the client data when no value is submitted. #### Parameters | | | | | --- | --- | --- | | mixed | $emptyData | The empty data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setErrorBubbling(bool $errorBubbling) Sets whether errors bubble up to the parent. #### Parameters | | | | | --- | --- | --- | | bool | $errorBubbling | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequired(bool $required) Sets whether this field is required to be filled out when submitted. #### Parameters | | | | | --- | --- | --- | | bool | $required | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setPropertyPath(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. #### Parameters | | | | | --- | --- | --- | | string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMapped(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. #### Parameters | | | | | --- | --- | --- | | bool | $mapped | Whether the form should be mapped | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setByReference(bool $byReference) Sets whether the form's data should be modified by reference. #### Parameters | | | | | --- | --- | --- | | bool | $byReference | Whether the data should be modified by reference | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setInheritData(bool $inheritData) Sets whether the form should read and write the data of its parent. #### Parameters | | | | | --- | --- | --- | | bool | $inheritData | Whether the form should inherit its parent's data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setCompound(bool $compound) Sets whether the form should be compound. #### Parameters | | | | | --- | --- | --- | | bool | $compound | Whether the form should be compound | #### Return Value | | | | --- | --- | | $this | The configuration object | #### See also | | | | --- | --- | | [FormConfigInterface::getCompound](formconfiginterface#method_getCompound "Symfony\Component\Form\FormConfigInterface") | | ### $this setType([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setData(mixed $data) Sets the initial data of the form. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The data of the form in application format | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataLocked(bool $locked) Locks the form's data to the data passed in the configuration. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Parameters | | | | | --- | --- | --- | | bool | $locked | Whether to lock the default data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### setFormFactory([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $formFactory | | ### $this setAction(string $action) Sets the target URL of the form. #### Parameters | | | | | --- | --- | --- | | string | $action | The target URL of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMethod(string $method) Sets the HTTP method used by the form. #### Parameters | | | | | --- | --- | --- | | string | $method | The HTTP method of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequestHandler([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAutoInitialize(bool $initialize) Sets whether the form should be initialized automatically. Should be set to true only for root forms. #### Parameters | | | | | --- | --- | --- | | bool | $initialize | True to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually. | #### Return Value | | | | --- | --- | | $this | The configuration object | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getFormConfig() Builds and returns the form configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | |
programming_docs
symfony Forms Forms ====== class **Forms** Entry point of the Form component. Use this class to conveniently create new form factories: ``` use Symfony\Component\Form\Forms; $formFactory = Forms::createFormFactory(); $form = $formFactory->createBuilder() ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType') ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType') ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType') ->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array( 'choices' => array('Male' => 'm', 'Female' => 'f'), )) ->getForm(); ``` You can also add custom extensions to the form factory: ``` $formFactory = Forms::createFormFactoryBuilder() ->addExtension(new AcmeExtension()) ->getFormFactory(); ``` If you create custom form types or type extensions, it is generally recommended to create your own extensions that lazily load these types and type extensions. In projects where performance does not matter that much, you can also pass them directly to the form factory: ``` $formFactory = Forms::createFormFactoryBuilder() ->addType(new PersonType()) ->addType(new PhoneNumberType()) ->addTypeExtension(new FormTypeHelpTextExtension()) ->getFormFactory(); ``` Support for the Validator component is provided by ValidatorExtension. This extension needs a validator object to function properly: ``` use Symfony\Component\Validator\Validation; use Symfony\Component\Form\Extension\Validator\ValidatorExtension; $validator = Validation::createValidator(); $formFactory = Forms::createFormFactoryBuilder() ->addExtension(new ValidatorExtension($validator)) ->getFormFactory(); ``` Support for the Templating component is provided by TemplatingExtension. This extension needs a PhpEngine object for rendering forms. As second argument you should pass the names of the default themes. Here is an example for using the default layout with " < div>" tags: ``` use Symfony\Component\Form\Extension\Templating\TemplatingExtension; $formFactory = Forms::createFormFactoryBuilder() ->addExtension(new TemplatingExtension($engine, null, array( 'FrameworkBundle:Form', ))) ->getFormFactory(); ``` The next example shows how to include the " < table>" layout: ``` use Symfony\Component\Form\Extension\Templating\TemplatingExtension; $formFactory = Forms::createFormFactoryBuilder() ->addExtension(new TemplatingExtension($engine, null, array( 'FrameworkBundle:Form', 'FrameworkBundle:FormTable', ))) ->getFormFactory(); ``` Methods ------- | | | | | --- | --- | --- | | static [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [createFormFactory](#method_createFormFactory)() Creates a form factory with the default configuration. | | | static [FormFactoryBuilderInterface](formfactorybuilderinterface "Symfony\Component\Form\FormFactoryBuilderInterface") | [createFormFactoryBuilder](#method_createFormFactoryBuilder)() Creates a form factory builder with the default configuration. | | Details ------- ### static [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") createFormFactory() Creates a form factory with the default configuration. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### static [FormFactoryBuilderInterface](formfactorybuilderinterface "Symfony\Component\Form\FormFactoryBuilderInterface") createFormFactoryBuilder() Creates a form factory builder with the default configuration. #### Return Value | | | | --- | --- | | [FormFactoryBuilderInterface](formfactorybuilderinterface "Symfony\Component\Form\FormFactoryBuilderInterface") | The form factory builder | symfony FormTypeInterface FormTypeInterface ================== interface **FormTypeInterface** Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::buildForm](formtypeextensioninterface#method_buildForm "Symfony\Component\Form\FormTypeExtensionInterface") | | ### buildView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::buildView](formtypeextensioninterface#method_buildView "Symfony\Component\Form\FormTypeExtensionInterface") | | ### finishView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::finishView](formtypeextensioninterface#method_finishView "Symfony\Component\Form\FormTypeExtensionInterface") | | ### configureOptions([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony FormError FormError ========== class **FormError** implements [Serializable](http://php.net/Serializable) Wraps errors in forms. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $messageTemplate | | | | protected | $messageParameters | | | | protected | $messagePluralization | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|null $message, string $messageTemplate = null, array $messageParameters = array(), int $messagePluralization = null, mixed $cause = null) Any array key in $messageParameters will be used as a placeholder in $messageTemplate. | | | string | [getMessage](#method_getMessage)() Returns the error message. | | | string | [getMessageTemplate](#method_getMessageTemplate)() Returns the error message template. | | | array | [getMessageParameters](#method_getMessageParameters)() Returns the parameters to be inserted in the message template. | | | int|null | [getMessagePluralization](#method_getMessagePluralization)() Returns the value for error message pluralization. | | | mixed | [getCause](#method_getCause)() Returns the cause of this error. | | | | [setOrigin](#method_setOrigin)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $origin) Sets the form that caused this error. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getOrigin](#method_getOrigin)() Returns the form that caused this error. | | | string | [serialize](#method_serialize)() Serializes this error. | | | | [unserialize](#method_unserialize)(string $serialized) Unserializes a serialized error. | | Details ------- ### \_\_construct(string|null $message, string $messageTemplate = null, array $messageParameters = array(), int $messagePluralization = null, mixed $cause = null) Any array key in $messageParameters will be used as a placeholder in $messageTemplate. #### Parameters | | | | | --- | --- | --- | | string|null | $message | The translated error message | | string | $messageTemplate | The template for the error message | | array | $messageParameters | The parameters that should be substituted in the message template | | int | $messagePluralization | The value for error message pluralization | | mixed | $cause | The cause of the error | #### See also | | | | --- | --- | | [Translator](../translation/translator "Symfony\Component\Translation\Translator") | | ### string getMessage() Returns the error message. #### Return Value | | | | --- | --- | | string | | ### string getMessageTemplate() Returns the error message template. #### Return Value | | | | --- | --- | | string | | ### array getMessageParameters() Returns the parameters to be inserted in the message template. #### Return Value | | | | --- | --- | | array | | ### int|null getMessagePluralization() Returns the value for error message pluralization. #### Return Value | | | | --- | --- | | int|null | | ### mixed getCause() Returns the cause of this error. #### Return Value | | | | --- | --- | | mixed | The cause of this error | ### setOrigin([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $origin) Sets the form that caused this error. This method must only be called once. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $origin | The form that caused this error | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | If the method is called more than once | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getOrigin() Returns the form that caused this error. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form that caused this error | ### string serialize() Serializes this error. #### Return Value | | | | --- | --- | | string | The serialized error | ### unserialize(string $serialized) Unserializes a serialized error. #### Parameters | | | | | --- | --- | --- | | string | $serialized | The serialized error | symfony Symfony\Component\Form\Command Symfony\Component\Form\Command ============================== Classes ------- | | | | --- | --- | | [DebugCommand](command/debugcommand "Symfony\Component\Form\Command\DebugCommand") | A console command for retrieving information about form types. | symfony Button Button ======= class **Button** implements [IteratorAggregate](http://php.net/IteratorAggregate), [FormInterface](forminterface "Symfony\Component\Form\FormInterface") A form button. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") $config) Creates a new button from a form configuration. | | | bool | [offsetExists](#method_offsetExists)(mixed $offset) Unsupported method. | | | | [offsetGet](#method_offsetGet)(mixed $offset) Unsupported method. | | | | [offsetSet](#method_offsetSet)(mixed $offset, mixed $value) Unsupported method. | | | | [offsetUnset](#method_offsetUnset)(mixed $offset) Unsupported method. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [setParent](#method_setParent)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null | [getParent](#method_getParent)() Returns the parent form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [add](#method_add)([FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Unsupported method. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [get](#method_get)(string $name) Unsupported method. | | | bool | [has](#method_has)(string $name) Unsupported method. | | | $this | [remove](#method_remove)(string $name) Unsupported method. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] | [all](#method_all)() Returns all children in this group. | | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | [getErrors](#method_getErrors)(bool $deep = false, bool $flatten = true) Returns the errors of this form. | | | $this | [setData](#method_setData)(mixed $modelData) Unsupported method. | | | mixed | [getData](#method_getData)() Unsupported method. | | | mixed | [getNormData](#method_getNormData)() Unsupported method. | | | mixed | [getViewData](#method_getViewData)() Unsupported method. | | | array | [getExtraData](#method_getExtraData)() Unsupported method. | | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getConfig](#method_getConfig)() Returns the button's configuration. | | | bool | [isSubmitted](#method_isSubmitted)() Returns whether the button is submitted. | | | string | [getName](#method_getName)() Returns the name by which the button is identified in forms. | | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Unsupported method. | | | $this | [addError](#method_addError)([FormError](formerror "Symfony\Component\Form\FormError") $error) Unsupported method. | | | bool | [isValid](#method_isValid)() Unsupported method. | | | bool | [isRequired](#method_isRequired)() Unsupported method. | | | bool | [isDisabled](#method_isDisabled)() Returns whether this form is disabled. | | | bool | [isEmpty](#method_isEmpty)() Unsupported method. | | | bool | [isSynchronized](#method_isSynchronized)() Unsupported method. | | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | [getTransformationFailure](#method_getTransformationFailure)() Unsupported method. | | | $this | [initialize](#method_initialize)() Unsupported method. | | | $this | [handleRequest](#method_handleRequest)(mixed $request = null) Unsupported method. | | | $this | [submit](#method_submit)(mixed $submittedData, bool $clearMissing = true) Submits data to the button. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getRoot](#method_getRoot)() Returns the root of the form tree. | | | bool | [isRoot](#method_isRoot)() Returns whether the field is the root of the form tree. | | | [FormView](formview "Symfony\Component\Form\FormView") | [createView](#method_createView)([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. | | | int | [count](#method_count)() Unsupported method. | | | [EmptyIterator](http://php.net/EmptyIterator) | [getIterator](#method_getIterator)() Unsupported method. | | Details ------- ### \_\_construct([FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") $config) Creates a new button from a form configuration. #### Parameters | | | | | --- | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | $config | The button's configuration | ### bool offsetExists(mixed $offset) Unsupported method. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | #### Return Value | | | | --- | --- | | bool | Always returns false | ### offsetGet(mixed $offset) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### offsetSet(mixed $offset, mixed $value) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | | mixed | $value | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### offsetUnset(mixed $offset) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") setParent([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $parent | | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | when trying to set a parent for a form with an empty name | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null getParent() Returns the parent form. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null | The parent form or null if there is none | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") add([FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int | $child | The FormInterface instance or the name of the child | | string|null | $type | The child's type, if a name was passed | | array | $options | The child's options, if a name was passed | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") get(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool has(string $name) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | bool | | ### $this remove(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child to remove | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] all() Returns all children in this group. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] | | ### [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") getErrors(bool $deep = false, bool $flatten = true) Returns the errors of this form. #### Parameters | | | | | --- | --- | --- | | bool | $deep | Whether to include errors of child forms as well | | bool | $flatten | Whether to flatten the list of errors in case $deep is set to true | #### Return Value | | | | --- | --- | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | An iterator over the {@link FormError} instances that where added to this form | ### $this setData(mixed $modelData) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $modelData | The data formatted as expected for the underlying object | #### Return Value | | | | --- | --- | | $this | | ### mixed getData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | | ### mixed getNormData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | when the field is not submitted, the default data is returned. When the field is submitted, the normalized submitted data is returned if the field is valid, null otherwise | ### mixed getViewData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | | ### array getExtraData() Unsupported method. #### Return Value | | | | --- | --- | | array | The submitted data which do not belong to a child | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getConfig() Returns the button's configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | The configuration | ### bool isSubmitted() Returns whether the button is submitted. #### Return Value | | | | --- | --- | | bool | true if the form is submitted, false otherwise | ### string getName() Returns the name by which the button is identified in forms. #### Return Value | | | | --- | --- | | string | The name of the form | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Unsupported method. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### $this addError([FormError](formerror "Symfony\Component\Form\FormError") $error) Unsupported method. #### Parameters | | | | | --- | --- | --- | | [FormError](formerror "Symfony\Component\Form\FormError") | $error | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool isValid() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### bool isRequired() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### bool isDisabled() Returns whether this form is disabled. The content of a disabled form is displayed, but not allowed to be modified. The validation of modified disabled forms should fail. Forms whose parents are disabled are considered disabled regardless of their own state. #### Return Value | | | | --- | --- | | bool | | ### bool isEmpty() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### bool isSynchronized() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null getTransformationFailure() Unsupported method. #### Return Value | | | | --- | --- | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | The transformation failure | ### $this initialize() Unsupported method. #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this handleRequest(mixed $request = null) Unsupported method. #### Parameters | | | | | --- | --- | --- | | mixed | $request | The request to handle | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this submit(mixed $submittedData, bool $clearMissing = true) Submits data to the button. #### Parameters | | | | | --- | --- | --- | | mixed | $submittedData | The submitted data | | bool | $clearMissing | Whether to set fields to NULL when they are missing in the submitted data | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the button has already been submitted | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getRoot() Returns the root of the form tree. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The root of the tree | ### bool isRoot() Returns whether the field is the root of the form tree. #### Return Value | | | | --- | --- | | bool | | ### [FormView](formview "Symfony\Component\Form\FormView") createView([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $parent | | #### Return Value | | | | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | The view | ### int count() Unsupported method. #### Return Value | | | | --- | --- | | int | Always returns 0 | ### [EmptyIterator](http://php.net/EmptyIterator) getIterator() Unsupported method. #### Return Value | | | | --- | --- | | [EmptyIterator](http://php.net/EmptyIterator) | Always returns an empty iterator |
programming_docs
symfony FormEvents FormEvents =========== class **FormEvents** To learn more about how form events work check the documentation entry at {@link https://symfony.com/doc/any/components/form/form\_events.html}. To learn how to dynamically modify forms using events check the cookbook entry at {@link https://symfony.com/doc/any/cookbook/form/dynamic\_form\_modification.html}. Constants --------- | | | | --- | --- | | PRE\_SUBMIT | *The PRE\_SUBMIT event is dispatched at the beginning of the Form::submit() method.* It can be used to: - Change data from the request, before submitting the data to the form. - Add or remove form fields, before submitting the data to the form. | | SUBMIT | *The SUBMIT event is dispatched just before the Form::submit() method transforms back the normalized data to the model and view data.* It can be used to change data from the normalized representation of the data. | | POST\_SUBMIT | *The FormEvents::POST\_SUBMIT event is dispatched after the Form::submit() once the model and view data have been denormalized.* It can be used to fetch data after denormalization. | | PRE\_SET\_DATA | *The FormEvents::PRE\_SET\_DATA event is dispatched at the beginning of the Form::setData() method.* It can be used to: - Modify the data given during pre-population; - Modify a form depending on the pre-populated data (adding or removing fields dynamically). | | POST\_SET\_DATA | *The FormEvents::POST\_SET\_DATA event is dispatched at the end of the Form::setData() method.* This event is mostly here for reading data after having pre-populated the form. | symfony FormFactoryBuilder FormFactoryBuilder =================== class **FormFactoryBuilder** implements [FormFactoryBuilderInterface](formfactorybuilderinterface "Symfony\Component\Form\FormFactoryBuilderInterface") The default implementation of FormFactoryBuilderInterface. Methods ------- | | | | | --- | --- | --- | | $this | [setResolvedTypeFactory](#method_setResolvedTypeFactory)([ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $resolvedTypeFactory) Sets the factory for creating ResolvedFormTypeInterface instances. | | | $this | [addExtension](#method_addExtension)([FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") $extension) Adds an extension to be loaded by the factory. | | | $this | [addExtensions](#method_addExtensions)(array $extensions) Adds a list of extensions to be loaded by the factory. | | | $this | [addType](#method_addType)([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type) Adds a form type to the factory. | | | $this | [addTypes](#method_addTypes)(array $types) Adds a list of form types to the factory. | | | $this | [addTypeExtension](#method_addTypeExtension)([FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") $typeExtension) Adds a form type extension to the factory. | | | $this | [addTypeExtensions](#method_addTypeExtensions)(array $typeExtensions) Adds a list of form type extensions to the factory. | | | $this | [addTypeGuesser](#method_addTypeGuesser)([FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") $typeGuesser) Adds a type guesser to the factory. | | | $this | [addTypeGuessers](#method_addTypeGuessers)(array $typeGuessers) Adds a list of type guessers to the factory. | | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Builds and returns the factory. | | Details ------- ### $this setResolvedTypeFactory([ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $resolvedTypeFactory) Sets the factory for creating ResolvedFormTypeInterface instances. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") | $resolvedTypeFactory | | #### Return Value | | | | --- | --- | | $this | | ### $this addExtension([FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") $extension) Adds an extension to be loaded by the factory. #### Parameters | | | | | --- | --- | --- | | [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") | $extension | | #### Return Value | | | | --- | --- | | $this | | ### $this addExtensions(array $extensions) Adds a list of extensions to be loaded by the factory. #### Parameters | | | | | --- | --- | --- | | array | $extensions | The extensions | #### Return Value | | | | --- | --- | | $this | | ### $this addType([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type) Adds a form type to the factory. #### Parameters | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | | ### $this addTypes(array $types) Adds a list of form types to the factory. #### Parameters | | | | | --- | --- | --- | | array | $types | The form types | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeExtension([FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") $typeExtension) Adds a form type extension to the factory. #### Parameters | | | | | --- | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") | $typeExtension | | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeExtensions(array $typeExtensions) Adds a list of form type extensions to the factory. #### Parameters | | | | | --- | --- | --- | | array | $typeExtensions | The form type extensions | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeGuesser([FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") $typeGuesser) Adds a type guesser to the factory. #### Parameters | | | | | --- | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") | $typeGuesser | | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeGuessers(array $typeGuessers) Adds a list of type guessers to the factory. #### Parameters | | | | | --- | --- | --- | | array | $typeGuessers | The type guessers | #### Return Value | | | | --- | --- | | $this | | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Builds and returns the factory. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | symfony PreloadedExtension PreloadedExtension =================== class **PreloadedExtension** implements [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") A form extension with preloaded types, type extensions and type guessers. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $types, array $typeExtensions, [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") $typeGuesser = null) Creates a new preloaded extension. | | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | | Details ------- ### \_\_construct(array $types, array $typeExtensions, [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") $typeGuesser = null) Creates a new preloaded extension. #### Parameters | | | | | --- | --- | --- | | array | $types | The types that the extension should support | | array | $typeExtensions | The type extensions that the extension should support | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") | $typeGuesser | The guesser that the extension should support | ### [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | symfony FormFactoryBuilderInterface FormFactoryBuilderInterface ============================ interface **FormFactoryBuilderInterface** A builder for FormFactoryInterface objects. Methods ------- | | | | | --- | --- | --- | | $this | [setResolvedTypeFactory](#method_setResolvedTypeFactory)([ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $resolvedTypeFactory) Sets the factory for creating ResolvedFormTypeInterface instances. | | | $this | [addExtension](#method_addExtension)([FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") $extension) Adds an extension to be loaded by the factory. | | | $this | [addExtensions](#method_addExtensions)(array $extensions) Adds a list of extensions to be loaded by the factory. | | | $this | [addType](#method_addType)([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type) Adds a form type to the factory. | | | $this | [addTypes](#method_addTypes)(array $types) Adds a list of form types to the factory. | | | $this | [addTypeExtension](#method_addTypeExtension)([FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") $typeExtension) Adds a form type extension to the factory. | | | $this | [addTypeExtensions](#method_addTypeExtensions)(array $typeExtensions) Adds a list of form type extensions to the factory. | | | $this | [addTypeGuesser](#method_addTypeGuesser)([FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") $typeGuesser) Adds a type guesser to the factory. | | | $this | [addTypeGuessers](#method_addTypeGuessers)(array $typeGuessers) Adds a list of type guessers to the factory. | | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Builds and returns the factory. | | Details ------- ### $this setResolvedTypeFactory([ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $resolvedTypeFactory) Sets the factory for creating ResolvedFormTypeInterface instances. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") | $resolvedTypeFactory | | #### Return Value | | | | --- | --- | | $this | | ### $this addExtension([FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") $extension) Adds an extension to be loaded by the factory. #### Parameters | | | | | --- | --- | --- | | [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") | $extension | | #### Return Value | | | | --- | --- | | $this | | ### $this addExtensions(array $extensions) Adds a list of extensions to be loaded by the factory. #### Parameters | | | | | --- | --- | --- | | array | $extensions | The extensions | #### Return Value | | | | --- | --- | | $this | | ### $this addType([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type) Adds a form type to the factory. #### Parameters | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | | ### $this addTypes(array $types) Adds a list of form types to the factory. #### Parameters | | | | | --- | --- | --- | | array | $types | The form types | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeExtension([FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") $typeExtension) Adds a form type extension to the factory. #### Parameters | | | | | --- | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface") | $typeExtension | | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeExtensions(array $typeExtensions) Adds a list of form type extensions to the factory. #### Parameters | | | | | --- | --- | --- | | array | $typeExtensions | The form type extensions | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeGuesser([FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") $typeGuesser) Adds a type guesser to the factory. #### Parameters | | | | | --- | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") | $typeGuesser | | #### Return Value | | | | --- | --- | | $this | | ### $this addTypeGuessers(array $typeGuessers) Adds a list of type guessers to the factory. #### Parameters | | | | | --- | --- | --- | | array | $typeGuessers | The type guessers | #### Return Value | | | | --- | --- | | $this | | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Builds and returns the factory. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | symfony SubmitButton SubmitButton ============= class **SubmitButton** extends [Button](button "Symfony\Component\Form\Button") implements [ClickableInterface](clickableinterface "Symfony\Component\Form\ClickableInterface") A button that submits the form. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") $config) Creates a new button from a form configuration. | from [Button](button#method___construct "Symfony\Component\Form\Button") | | bool | [offsetExists](#method_offsetExists)(mixed $offset) Unsupported method. | from [Button](button#method_offsetExists "Symfony\Component\Form\Button") | | | [offsetGet](#method_offsetGet)(mixed $offset) Unsupported method. | from [Button](button#method_offsetGet "Symfony\Component\Form\Button") | | | [offsetSet](#method_offsetSet)(mixed $offset, mixed $value) Unsupported method. | from [Button](button#method_offsetSet "Symfony\Component\Form\Button") | | | [offsetUnset](#method_offsetUnset)(mixed $offset) Unsupported method. | from [Button](button#method_offsetUnset "Symfony\Component\Form\Button") | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [setParent](#method_setParent)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. | from [Button](button#method_setParent "Symfony\Component\Form\Button") | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null | [getParent](#method_getParent)() Returns the parent form. | from [Button](button#method_getParent "Symfony\Component\Form\Button") | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [add](#method_add)([FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Unsupported method. | from [Button](button#method_add "Symfony\Component\Form\Button") | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [get](#method_get)(string $name) Unsupported method. | from [Button](button#method_get "Symfony\Component\Form\Button") | | bool | [has](#method_has)(string $name) Unsupported method. | from [Button](button#method_has "Symfony\Component\Form\Button") | | $this | [remove](#method_remove)(string $name) Unsupported method. | from [Button](button#method_remove "Symfony\Component\Form\Button") | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] | [all](#method_all)() Returns all children in this group. | from [Button](button#method_all "Symfony\Component\Form\Button") | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | [getErrors](#method_getErrors)(bool $deep = false, bool $flatten = true) Returns the errors of this form. | from [Button](button#method_getErrors "Symfony\Component\Form\Button") | | $this | [setData](#method_setData)(mixed $modelData) Unsupported method. | from [Button](button#method_setData "Symfony\Component\Form\Button") | | mixed | [getData](#method_getData)() Unsupported method. | from [Button](button#method_getData "Symfony\Component\Form\Button") | | mixed | [getNormData](#method_getNormData)() Unsupported method. | from [Button](button#method_getNormData "Symfony\Component\Form\Button") | | mixed | [getViewData](#method_getViewData)() Unsupported method. | from [Button](button#method_getViewData "Symfony\Component\Form\Button") | | array | [getExtraData](#method_getExtraData)() Unsupported method. | from [Button](button#method_getExtraData "Symfony\Component\Form\Button") | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getConfig](#method_getConfig)() Returns the button's configuration. | from [Button](button#method_getConfig "Symfony\Component\Form\Button") | | bool | [isSubmitted](#method_isSubmitted)() Returns whether the button is submitted. | from [Button](button#method_isSubmitted "Symfony\Component\Form\Button") | | string | [getName](#method_getName)() Returns the name by which the button is identified in forms. | from [Button](button#method_getName "Symfony\Component\Form\Button") | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Unsupported method. | from [Button](button#method_getPropertyPath "Symfony\Component\Form\Button") | | $this | [addError](#method_addError)([FormError](formerror "Symfony\Component\Form\FormError") $error) Unsupported method. | from [Button](button#method_addError "Symfony\Component\Form\Button") | | bool | [isValid](#method_isValid)() Unsupported method. | from [Button](button#method_isValid "Symfony\Component\Form\Button") | | bool | [isRequired](#method_isRequired)() Unsupported method. | from [Button](button#method_isRequired "Symfony\Component\Form\Button") | | bool | [isDisabled](#method_isDisabled)() Returns whether this form is disabled. | from [Button](button#method_isDisabled "Symfony\Component\Form\Button") | | bool | [isEmpty](#method_isEmpty)() Unsupported method. | from [Button](button#method_isEmpty "Symfony\Component\Form\Button") | | bool | [isSynchronized](#method_isSynchronized)() Unsupported method. | from [Button](button#method_isSynchronized "Symfony\Component\Form\Button") | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | [getTransformationFailure](#method_getTransformationFailure)() Unsupported method. | from [Button](button#method_getTransformationFailure "Symfony\Component\Form\Button") | | $this | [initialize](#method_initialize)() Unsupported method. | from [Button](button#method_initialize "Symfony\Component\Form\Button") | | $this | [handleRequest](#method_handleRequest)(mixed $request = null) Unsupported method. | from [Button](button#method_handleRequest "Symfony\Component\Form\Button") | | $this | [submit](#method_submit)(mixed $submittedData, bool $clearMissing = true) Submits data to the button. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getRoot](#method_getRoot)() Returns the root of the form tree. | from [Button](button#method_getRoot "Symfony\Component\Form\Button") | | bool | [isRoot](#method_isRoot)() Returns whether the field is the root of the form tree. | from [Button](button#method_isRoot "Symfony\Component\Form\Button") | | [FormView](formview "Symfony\Component\Form\FormView") | [createView](#method_createView)([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. | from [Button](button#method_createView "Symfony\Component\Form\Button") | | int | [count](#method_count)() Unsupported method. | from [Button](button#method_count "Symfony\Component\Form\Button") | | [EmptyIterator](http://php.net/EmptyIterator) | [getIterator](#method_getIterator)() Unsupported method. | from [Button](button#method_getIterator "Symfony\Component\Form\Button") | | bool | [isClicked](#method_isClicked)() Returns whether this element was clicked. | | Details ------- ### \_\_construct([FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") $config) Creates a new button from a form configuration. #### Parameters | | | | | --- | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | $config | The button's configuration | ### bool offsetExists(mixed $offset) Unsupported method. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | #### Return Value | | | | --- | --- | | bool | Always returns false | ### offsetGet(mixed $offset) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### offsetSet(mixed $offset, mixed $value) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | | mixed | $value | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### offsetUnset(mixed $offset) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $offset | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") setParent([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $parent | | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](exception/logicexception "Symfony\Component\Form\Exception\LogicException") | when trying to set a parent for a form with an empty name | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null getParent() Returns the parent form. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|null | The parent form or null if there is none | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") add([FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")|string|int | $child | The FormInterface instance or the name of the child | | string|null | $type | The child's type, if a name was passed | | array | $options | The child's options, if a name was passed | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") get(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool has(string $name) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | bool | | ### $this remove(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child to remove | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] all() Returns all children in this group. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface")[] | | ### [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") getErrors(bool $deep = false, bool $flatten = true) Returns the errors of this form. #### Parameters | | | | | --- | --- | --- | | bool | $deep | Whether to include errors of child forms as well | | bool | $flatten | Whether to flatten the list of errors in case $deep is set to true | #### Return Value | | | | --- | --- | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | An iterator over the {@link FormError} instances that where added to this form | ### $this setData(mixed $modelData) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $modelData | The data formatted as expected for the underlying object | #### Return Value | | | | --- | --- | | $this | | ### mixed getData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | | ### mixed getNormData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | when the field is not submitted, the default data is returned. When the field is submitted, the normalized submitted data is returned if the field is valid, null otherwise | ### mixed getViewData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | | ### array getExtraData() Unsupported method. #### Return Value | | | | --- | --- | | array | The submitted data which do not belong to a child | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getConfig() Returns the button's configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | The configuration | ### bool isSubmitted() Returns whether the button is submitted. #### Return Value | | | | --- | --- | | bool | true if the form is submitted, false otherwise | ### string getName() Returns the name by which the button is identified in forms. #### Return Value | | | | --- | --- | | string | The name of the form | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Unsupported method. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### $this addError([FormError](formerror "Symfony\Component\Form\FormError") $error) Unsupported method. #### Parameters | | | | | --- | --- | --- | | [FormError](formerror "Symfony\Component\Form\FormError") | $error | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool isValid() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### bool isRequired() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### bool isDisabled() Returns whether this form is disabled. The content of a disabled form is displayed, but not allowed to be modified. The validation of modified disabled forms should fail. Forms whose parents are disabled are considered disabled regardless of their own state. #### Return Value | | | | --- | --- | | bool | | ### bool isEmpty() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### bool isSynchronized() Unsupported method. #### Return Value | | | | --- | --- | | bool | | ### [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null getTransformationFailure() Unsupported method. #### Return Value | | | | --- | --- | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | The transformation failure | ### $this initialize() Unsupported method. #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this handleRequest(mixed $request = null) Unsupported method. #### Parameters | | | | | --- | --- | --- | | mixed | $request | The request to handle | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this submit(mixed $submittedData, bool $clearMissing = true) Submits data to the button. #### Parameters | | | | | --- | --- | --- | | mixed | $submittedData | The submitted data | | bool | $clearMissing | Whether to set fields to NULL when they are missing in the submitted data | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getRoot() Returns the root of the form tree. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The root of the tree | ### bool isRoot() Returns whether the field is the root of the form tree. #### Return Value | | | | --- | --- | | bool | | ### [FormView](formview "Symfony\Component\Form\FormView") createView([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $parent | | #### Return Value | | | | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | The view | ### int count() Unsupported method. #### Return Value | | | | --- | --- | | int | Always returns 0 | ### [EmptyIterator](http://php.net/EmptyIterator) getIterator() Unsupported method. #### Return Value | | | | --- | --- | | [EmptyIterator](http://php.net/EmptyIterator) | Always returns an empty iterator | ### bool isClicked() Returns whether this element was clicked. #### Return Value | | | | --- | --- | | bool | Whether this element was clicked |
programming_docs
symfony FormRendererInterface FormRendererInterface ====================== interface **FormRendererInterface** Renders a form into HTML. Methods ------- | | | | | --- | --- | --- | | [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") | [getEngine](#method_getEngine)() Returns the engine used by this renderer. | | | | [setTheme](#method_setTheme)([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. | | | string | [renderBlock](#method_renderBlock)([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName, array $variables = array()) Renders a named block of the form theme. | | | string | [searchAndRenderBlock](#method_searchAndRenderBlock)([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockNameSuffix, array $variables = array()) Searches and renders a block for a given name suffix. | | | string | [renderCsrfToken](#method_renderCsrfToken)(string $tokenId) Renders a CSRF token. | | | string | [humanize](#method_humanize)(string $text) Makes a technical name human readable. | | Details ------- ### [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") getEngine() Returns the engine used by this renderer. #### Return Value | | | | --- | --- | | [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") | The renderer engine | ### setTheme([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view to assign the theme(s) to | | mixed | $themes | The theme(s). The type of these themes is open to the implementation. | | bool | $useDefaultThemes | If true, will use default themes specified in the renderer | ### string renderBlock([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName, array $variables = array()) Renders a named block of the form theme. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for which to render the block | | string | $blockName | The name of the block | | array | $variables | The variables to pass to the template | #### Return Value | | | | --- | --- | | string | The HTML markup | ### string searchAndRenderBlock([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockNameSuffix, array $variables = array()) Searches and renders a block for a given name suffix. The block is searched by combining the block names stored in the form view with the given suffix. If a block name is found, that block is rendered. If this method is called recursively, the block search is continued where a block was found before. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for which to render the block | | string | $blockNameSuffix | The suffix of the block name | | array | $variables | The variables to pass to the template | #### Return Value | | | | --- | --- | | string | The HTML markup | ### string renderCsrfToken(string $tokenId) Renders a CSRF token. Use this helper for CSRF protection without the overhead of creating a form. ``` <input type="hidden" name="token" value="<?php $renderer->renderCsrfToken('rm_user_'.$user->getId()) ?>"> ``` Check the token in your action using the same token ID. ``` // $csrfProvider being an instance of Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { throw new \RuntimeException('CSRF attack detected.'); } ``` #### Parameters | | | | | --- | --- | --- | | string | $tokenId | The ID of the CSRF token | #### Return Value | | | | --- | --- | | string | A CSRF token | ### string humanize(string $text) Makes a technical name human readable. Sequences of underscores are replaced by single spaces. The first letter of the resulting string is capitalized, while all other letters are turned to lowercase. #### Parameters | | | | | --- | --- | --- | | string | $text | The text to humanize | #### Return Value | | | | --- | --- | | string | The humanized text | symfony Symfony\Component\Form\ChoiceList Symfony\Component\Form\ChoiceList ================================= Namespaces ---------- [Symfony\Component\Form\ChoiceList\Factory](choicelist/factory)[Symfony\Component\Form\ChoiceList\Loader](choicelist/loader)[Symfony\Component\Form\ChoiceList\View](choicelist/view) Classes ------- | | | | --- | --- | | [ArrayChoiceList](choicelist/arraychoicelist "Symfony\Component\Form\ChoiceList\ArrayChoiceList") | A list of choices with arbitrary data types. | | [LazyChoiceList](choicelist/lazychoicelist "Symfony\Component\Form\ChoiceList\LazyChoiceList") | A choice list that loads its choices lazily. | Interfaces ---------- | | | | --- | --- | | *[ChoiceListInterface](choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface")* | A list of choices that can be selected in a choice field. | symfony FormRendererEngineInterface FormRendererEngineInterface ============================ interface **FormRendererEngineInterface** Adapter for rendering form templates with a specific templating engine. Methods ------- | | | | | --- | --- | --- | | | [setTheme](#method_setTheme)([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. | | | mixed | [getResourceForBlockName](#method_getResourceForBlockName)([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName) Returns the resource for a block name. | | | mixed | [getResourceForBlockNameHierarchy](#method_getResourceForBlockNameHierarchy)([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the resource for a block hierarchy. | | | int|bool | [getResourceHierarchyLevel](#method_getResourceHierarchyLevel)([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the hierarchy level at which a resource can be found. | | | string | [renderBlock](#method_renderBlock)([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $resource, string $blockName, array $variables = array()) Renders a block in the given renderer resource. | | Details ------- ### setTheme([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view to assign the theme(s) to | | mixed | $themes | The theme(s). The type of these themes is open to the implementation. | | bool | $useDefaultThemes | If true, will use default themes specified in the engine | ### mixed getResourceForBlockName([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName) Returns the resource for a block name. The resource is first searched in the themes attached to $view, then in the themes of its parent view and so on, until a resource was found. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc. | | string | $blockName | The name of the block to render | #### Return Value | | | | --- | --- | | mixed | the renderer resource or false, if none was found | ### mixed getResourceForBlockNameHierarchy([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the resource for a block hierarchy. A block hierarchy is an array which starts with the root of the hierarchy and continues with the child of that root, the child of that child etc. The following is an example for a block hierarchy: ``` form_widget text_widget url_widget ``` In this example, "url\_widget" is the most specific block, while the other blocks are its ancestors in the hierarchy. The second parameter $hierarchyLevel determines the level of the hierarchy that should be rendered. For example, if $hierarchyLevel is 2 for the above hierarchy, the engine will first look for the block "url\_widget", then, if that does not exist, for the block "text\_widget" etc. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc. | | array | $blockNameHierarchy | The block name hierarchy, with the root block at the beginning | | int | $hierarchyLevel | The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy. | #### Return Value | | | | --- | --- | | mixed | The renderer resource or false, if none was found | ### int|bool getResourceHierarchyLevel([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the hierarchy level at which a resource can be found. A block hierarchy is an array which starts with the root of the hierarchy and continues with the child of that root, the child of that child etc. The following is an example for a block hierarchy: ``` form_widget text_widget url_widget ``` The second parameter $hierarchyLevel determines the level of the hierarchy that should be rendered. If we call this method with the hierarchy level 2, the engine will first look for a resource for block "url\_widget". If such a resource exists, the method returns 2. Otherwise it tries to find a resource for block "text\_widget" (at level 1) and, again, returns 1 if a resource was found. The method continues to look for resources until the root level was reached and nothing was found. In this case false is returned. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc. | | array | $blockNameHierarchy | The block name hierarchy, with the root block at the beginning | | int | $hierarchyLevel | The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy. | #### Return Value | | | | --- | --- | | int|bool | The hierarchy level or false, if no resource was found | ### string renderBlock([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $resource, string $blockName, array $variables = array()) Renders a block in the given renderer resource. The resource can be obtained by calling {@link getResourceForBlock()} or {@link getResourceForBlockHierarchy()}. The type of the resource is decided by the implementation. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view to render | | mixed | $resource | The renderer resource | | string | $blockName | The name of the block to render | | array | $variables | The variables to pass to the template | #### Return Value | | | | --- | --- | | string | The HTML markup | symfony FormBuilder FormBuilder ============ class **FormBuilder** extends [FormConfigBuilder](formconfigbuilder "Symfony\Component\Form\FormConfigBuilder") implements [IteratorAggregate](http://php.net/IteratorAggregate), [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") A builder for creating {@link Form} instances. Properties ---------- | | | | | | --- | --- | --- | --- | | protected bool | $locked | | from [FormConfigBuilder](formconfigbuilder#property_locked "Symfony\Component\Form\FormConfigBuilder") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|int $name, string|null $dataClass, [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, array $options = array()) Creates an empty form configuration. | | | $this | [addEventListener](#method_addEventListener)(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. | from [FormConfigBuilder](formconfigbuilder#method_addEventListener "Symfony\Component\Form\FormConfigBuilder") | | $this | [addEventSubscriber](#method_addEventSubscriber)([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. | from [FormConfigBuilder](formconfigbuilder#method_addEventSubscriber "Symfony\Component\Form\FormConfigBuilder") | | $this | [addViewTransformer](#method_addViewTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. | from [FormConfigBuilder](formconfigbuilder#method_addViewTransformer "Symfony\Component\Form\FormConfigBuilder") | | $this | [resetViewTransformers](#method_resetViewTransformers)() Clears the view transformers. | from [FormConfigBuilder](formconfigbuilder#method_resetViewTransformers "Symfony\Component\Form\FormConfigBuilder") | | $this | [addModelTransformer](#method_addModelTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. | from [FormConfigBuilder](formconfigbuilder#method_addModelTransformer "Symfony\Component\Form\FormConfigBuilder") | | $this | [resetModelTransformers](#method_resetModelTransformers)() Clears the normalization transformers. | from [FormConfigBuilder](formconfigbuilder#method_resetModelTransformers "Symfony\Component\Form\FormConfigBuilder") | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Returns the event dispatcher used to dispatch form events. | from [FormConfigBuilder](formconfigbuilder#method_getEventDispatcher "Symfony\Component\Form\FormConfigBuilder") | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | from [FormConfigBuilder](formconfigbuilder#method_getName "Symfony\Component\Form\FormConfigBuilder") | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form should be mapped to. | from [FormConfigBuilder](formconfigbuilder#method_getPropertyPath "Symfony\Component\Form\FormConfigBuilder") | | bool | [getMapped](#method_getMapped)() Returns whether the form should be mapped to an element of its parent's data. | from [FormConfigBuilder](formconfigbuilder#method_getMapped "Symfony\Component\Form\FormConfigBuilder") | | bool | [getByReference](#method_getByReference)() Returns whether the form's data should be modified by reference. | from [FormConfigBuilder](formconfigbuilder#method_getByReference "Symfony\Component\Form\FormConfigBuilder") | | bool | [getInheritData](#method_getInheritData)() Returns whether the form should read and write the data of its parent. | from [FormConfigBuilder](formconfigbuilder#method_getInheritData "Symfony\Component\Form\FormConfigBuilder") | | bool | [getCompound](#method_getCompound)() Returns whether the form is compound. | from [FormConfigBuilder](formconfigbuilder#method_getCompound "Symfony\Component\Form\FormConfigBuilder") | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form types used to construct the form. | from [FormConfigBuilder](formconfigbuilder#method_getType "Symfony\Component\Form\FormConfigBuilder") | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Returns the view transformers of the form. | from [FormConfigBuilder](formconfigbuilder#method_getViewTransformers "Symfony\Component\Form\FormConfigBuilder") | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Returns the model transformers of the form. | from [FormConfigBuilder](formconfigbuilder#method_getModelTransformers "Symfony\Component\Form\FormConfigBuilder") | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Returns the data mapper of the form. | from [FormConfigBuilder](formconfigbuilder#method_getDataMapper "Symfony\Component\Form\FormConfigBuilder") | | bool | [getRequired](#method_getRequired)() Returns whether the form is required. | from [FormConfigBuilder](formconfigbuilder#method_getRequired "Symfony\Component\Form\FormConfigBuilder") | | bool | [getDisabled](#method_getDisabled)() Returns whether the form is disabled. | from [FormConfigBuilder](formconfigbuilder#method_getDisabled "Symfony\Component\Form\FormConfigBuilder") | | bool | [getErrorBubbling](#method_getErrorBubbling)() Returns whether errors attached to the form will bubble to its parent. | from [FormConfigBuilder](formconfigbuilder#method_getErrorBubbling "Symfony\Component\Form\FormConfigBuilder") | | mixed | [getEmptyData](#method_getEmptyData)() Returns the data that should be returned when the form is empty. | from [FormConfigBuilder](formconfigbuilder#method_getEmptyData "Symfony\Component\Form\FormConfigBuilder") | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the form. | from [FormConfigBuilder](formconfigbuilder#method_getAttributes "Symfony\Component\Form\FormConfigBuilder") | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | from [FormConfigBuilder](formconfigbuilder#method_hasAttribute "Symfony\Component\Form\FormConfigBuilder") | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | from [FormConfigBuilder](formconfigbuilder#method_getAttribute "Symfony\Component\Form\FormConfigBuilder") | | mixed | [getData](#method_getData)() Returns the initial data of the form. | from [FormConfigBuilder](formconfigbuilder#method_getData "Symfony\Component\Form\FormConfigBuilder") | | string|null | [getDataClass](#method_getDataClass)() Returns the class of the form data or null if the data is scalar or an array. | from [FormConfigBuilder](formconfigbuilder#method_getDataClass "Symfony\Component\Form\FormConfigBuilder") | | bool | [getDataLocked](#method_getDataLocked)() Returns whether the form's data is locked. | from [FormConfigBuilder](formconfigbuilder#method_getDataLocked "Symfony\Component\Form\FormConfigBuilder") | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Returns the form factory used for creating new forms. | from [FormConfigBuilder](formconfigbuilder#method_getFormFactory "Symfony\Component\Form\FormConfigBuilder") | | string | [getAction](#method_getAction)() Returns the target URL of the form. | from [FormConfigBuilder](formconfigbuilder#method_getAction "Symfony\Component\Form\FormConfigBuilder") | | string | [getMethod](#method_getMethod)() Returns the HTTP method used by the form. | from [FormConfigBuilder](formconfigbuilder#method_getMethod "Symfony\Component\Form\FormConfigBuilder") | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Returns the request handler used by the form. | from [FormConfigBuilder](formconfigbuilder#method_getRequestHandler "Symfony\Component\Form\FormConfigBuilder") | | bool | [getAutoInitialize](#method_getAutoInitialize)() Returns whether the form should be initialized upon creation. | from [FormConfigBuilder](formconfigbuilder#method_getAutoInitialize "Symfony\Component\Form\FormConfigBuilder") | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the form. | from [FormConfigBuilder](formconfigbuilder#method_getOptions "Symfony\Component\Form\FormConfigBuilder") | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | from [FormConfigBuilder](formconfigbuilder#method_hasOption "Symfony\Component\Form\FormConfigBuilder") | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | from [FormConfigBuilder](formconfigbuilder#method_getOption "Symfony\Component\Form\FormConfigBuilder") | | $this | [setAttribute](#method_setAttribute)(string $name, mixed $value) Sets the value for an attribute. | from [FormConfigBuilder](formconfigbuilder#method_setAttribute "Symfony\Component\Form\FormConfigBuilder") | | $this | [setAttributes](#method_setAttributes)(array $attributes) Sets the attributes. | from [FormConfigBuilder](formconfigbuilder#method_setAttributes "Symfony\Component\Form\FormConfigBuilder") | | $this | [setDataMapper](#method_setDataMapper)([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. | from [FormConfigBuilder](formconfigbuilder#method_setDataMapper "Symfony\Component\Form\FormConfigBuilder") | | $this | [setDisabled](#method_setDisabled)(bool $disabled) Set whether the form is disabled. | from [FormConfigBuilder](formconfigbuilder#method_setDisabled "Symfony\Component\Form\FormConfigBuilder") | | $this | [setEmptyData](#method_setEmptyData)(mixed $emptyData) Sets the data used for the client data when no value is submitted. | from [FormConfigBuilder](formconfigbuilder#method_setEmptyData "Symfony\Component\Form\FormConfigBuilder") | | $this | [setErrorBubbling](#method_setErrorBubbling)(bool $errorBubbling) Sets whether errors bubble up to the parent. | from [FormConfigBuilder](formconfigbuilder#method_setErrorBubbling "Symfony\Component\Form\FormConfigBuilder") | | $this | [setRequired](#method_setRequired)(bool $required) Sets whether this field is required to be filled out when submitted. | from [FormConfigBuilder](formconfigbuilder#method_setRequired "Symfony\Component\Form\FormConfigBuilder") | | $this | [setPropertyPath](#method_setPropertyPath)(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. | from [FormConfigBuilder](formconfigbuilder#method_setPropertyPath "Symfony\Component\Form\FormConfigBuilder") | | $this | [setMapped](#method_setMapped)(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. | from [FormConfigBuilder](formconfigbuilder#method_setMapped "Symfony\Component\Form\FormConfigBuilder") | | $this | [setByReference](#method_setByReference)(bool $byReference) Sets whether the form's data should be modified by reference. | from [FormConfigBuilder](formconfigbuilder#method_setByReference "Symfony\Component\Form\FormConfigBuilder") | | $this | [setInheritData](#method_setInheritData)(bool $inheritData) Sets whether the form should read and write the data of its parent. | from [FormConfigBuilder](formconfigbuilder#method_setInheritData "Symfony\Component\Form\FormConfigBuilder") | | $this | [setCompound](#method_setCompound)(bool $compound) Sets whether the form should be compound. | from [FormConfigBuilder](formconfigbuilder#method_setCompound "Symfony\Component\Form\FormConfigBuilder") | | $this | [setType](#method_setType)([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. | from [FormConfigBuilder](formconfigbuilder#method_setType "Symfony\Component\Form\FormConfigBuilder") | | $this | [setData](#method_setData)(mixed $data) Sets the initial data of the form. | from [FormConfigBuilder](formconfigbuilder#method_setData "Symfony\Component\Form\FormConfigBuilder") | | $this | [setDataLocked](#method_setDataLocked)(bool $locked) Locks the form's data to the data passed in the configuration. | from [FormConfigBuilder](formconfigbuilder#method_setDataLocked "Symfony\Component\Form\FormConfigBuilder") | | | [setFormFactory](#method_setFormFactory)([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. | from [FormConfigBuilder](formconfigbuilder#method_setFormFactory "Symfony\Component\Form\FormConfigBuilder") | | $this | [setAction](#method_setAction)(string $action) Sets the target URL of the form. | from [FormConfigBuilder](formconfigbuilder#method_setAction "Symfony\Component\Form\FormConfigBuilder") | | $this | [setMethod](#method_setMethod)(string $method) Sets the HTTP method used by the form. | from [FormConfigBuilder](formconfigbuilder#method_setMethod "Symfony\Component\Form\FormConfigBuilder") | | $this | [setRequestHandler](#method_setRequestHandler)([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. | from [FormConfigBuilder](formconfigbuilder#method_setRequestHandler "Symfony\Component\Form\FormConfigBuilder") | | $this | [setAutoInitialize](#method_setAutoInitialize)(bool $initialize) Sets whether the form should be initialized automatically. | from [FormConfigBuilder](formconfigbuilder#method_setAutoInitialize "Symfony\Component\Form\FormConfigBuilder") | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getFormConfig](#method_getFormConfig)() Builds and returns the form configuration. | | | static | [validateName](#method_validateName)(string|int $name) Validates whether the given variable is a valid form name. | from [FormConfigBuilder](formconfigbuilder#method_validateName "Symfony\Component\Form\FormConfigBuilder") | | static bool | [isValidName](#method_isValidName)(string $name) Returns whether the given variable contains a valid form name. | from [FormConfigBuilder](formconfigbuilder#method_isValidName "Symfony\Component\Form\FormConfigBuilder") | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [add](#method_add)(string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [create](#method_create)(string $name, string|null $type = null, array $options = array()) Creates a form builder. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [get](#method_get)(string $name) Returns a child by name. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [remove](#method_remove)(string $name) Removes the field with the given name. | | | bool | [has](#method_has)(string $name) Returns whether a field with the given name exists. | | | array | [all](#method_all)() Returns the children. | | | | [count](#method_count)() {@inheritdoc} | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getForm](#method_getForm)() Creates the form. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface")[] | [getIterator](#method_getIterator)() {@inheritdoc} | | Details ------- ### \_\_construct(string|int $name, string|null $dataClass, [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, array $options = array()) Creates an empty form configuration. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The form name | | string|null | $dataClass | The class of the form's data | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $dispatcher | The event dispatcher | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | | | array | $options | The form options | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the data class is not a valid class or if the name contains invalid characters | ### $this addEventListener(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. #### Parameters | | | | | --- | --- | --- | | string | $eventName | The name of the event to listen to | | callable | $listener | The listener to execute | | int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addEventSubscriber([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. #### Parameters | | | | | --- | --- | --- | | [EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") | $subscriber | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addViewTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. The transform method of the transformer is used to convert data from the normalized to the view format. The reverseTransform method of the transformer is used to convert from the view to the normalized format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $viewTransformer | | | bool | $forcePrepend | If set to true, prepend instead of appending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetViewTransformers() Clears the view transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addModelTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. The transform method of the transformer is used to convert data from the model to the normalized format. The reverseTransform method of the transformer is used to convert from the normalized to the model format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $modelTransformer | | | bool | $forceAppend | If set to true, append instead of prepending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetModelTransformers() Clears the normalization transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Returns the event dispatcher used to dispatch form events. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form should be mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Returns whether the form should be mapped to an element of its parent's data. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Returns whether the form's data should be modified by reference. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getInheritData() Returns whether the form should read and write the data of its parent. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### bool getCompound() Returns whether the form is compound. This property is independent of whether the form actually has children. A form can be compound and have no children at all, like for example an empty collection form. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form types used to construct the form. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Returns the view transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Returns the model transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Returns the data mapper of the form. #### Return Value | | | | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Returns whether the form is required. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the form is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Returns whether errors attached to the form will bubble to its parent. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Returns the data that should be returned when the form is empty. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the form. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Returns the initial data of the form. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Returns the class of the form data or null if the data is scalar or an array. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Returns whether the form's data is locked. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Returns the form factory used for creating new forms. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Returns the target URL of the form. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Returns the HTTP method used by the form. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Returns the request handler used by the form. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Returns whether the form should be initialized upon creation. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### array getOptions() Returns all options passed during the construction of the form. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value | ### $this setAttribute(string $name, mixed $value) Sets the value for an attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the attribute | | mixed | $value | The value of the attribute | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttributes(array $attributes) Sets the attributes. #### Parameters | | | | | --- | --- | --- | | array | $attributes | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataMapper([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. #### Parameters | | | | | --- | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") | $dataMapper | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDisabled(bool $disabled) Set whether the form is disabled. #### Parameters | | | | | --- | --- | --- | | bool | $disabled | Whether the form is disabled | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setEmptyData(mixed $emptyData) Sets the data used for the client data when no value is submitted. #### Parameters | | | | | --- | --- | --- | | mixed | $emptyData | The empty data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setErrorBubbling(bool $errorBubbling) Sets whether errors bubble up to the parent. #### Parameters | | | | | --- | --- | --- | | bool | $errorBubbling | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequired(bool $required) Sets whether this field is required to be filled out when submitted. #### Parameters | | | | | --- | --- | --- | | bool | $required | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setPropertyPath(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. #### Parameters | | | | | --- | --- | --- | | string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMapped(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. #### Parameters | | | | | --- | --- | --- | | bool | $mapped | Whether the form should be mapped | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setByReference(bool $byReference) Sets whether the form's data should be modified by reference. #### Parameters | | | | | --- | --- | --- | | bool | $byReference | Whether the data should be modified by reference | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setInheritData(bool $inheritData) Sets whether the form should read and write the data of its parent. #### Parameters | | | | | --- | --- | --- | | bool | $inheritData | Whether the form should inherit its parent's data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setCompound(bool $compound) Sets whether the form should be compound. #### Parameters | | | | | --- | --- | --- | | bool | $compound | Whether the form should be compound | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setType([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setData(mixed $data) Sets the initial data of the form. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The data of the form in application format | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataLocked(bool $locked) Locks the form's data to the data passed in the configuration. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Parameters | | | | | --- | --- | --- | | bool | $locked | Whether to lock the default data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### setFormFactory([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $formFactory | | ### $this setAction(string $action) Sets the target URL of the form. #### Parameters | | | | | --- | --- | --- | | string | $action | The target URL of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMethod(string $method) Sets the HTTP method used by the form. #### Parameters | | | | | --- | --- | --- | | string | $method | The HTTP method of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequestHandler([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAutoInitialize(bool $initialize) Sets whether the form should be initialized automatically. Should be set to true only for root forms. #### Parameters | | | | | --- | --- | --- | | bool | $initialize | true to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually | #### Return Value | | | | --- | --- | | $this | The configuration object | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getFormConfig() Builds and returns the form configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | | ### static validateName(string|int $name) Validates whether the given variable is a valid form name. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The tested form name | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the name is not a string or an integer | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the name contains invalid characters | ### static bool isValidName(string $name) Returns whether the given variable contains a valid form name. A name is accepted if it * is empty * starts with a letter, digit or underscore * contains only letters, digits, numbers, underscores ("\_"), hyphens ("-") and colons (":") #### Parameters | | | | | --- | --- | --- | | string | $name | The tested form name | #### Return Value | | | | --- | --- | | bool | Whether the name is valid | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") add(string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten. If you add a nested group, this group should also be represented in the object hierarchy. #### Parameters | | | | | --- | --- | --- | | string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $child | | | string|null | $type | | | array | $options | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") create(string $name, string|null $type = null, array $options = array()) Creates a form builder. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the form or the name of the property | | string|null | $type | The type of the form or null if name is a property | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") get(string $name) Returns a child by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given child does not exist | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") remove(string $name) Removes the field with the given name. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | ### bool has(string $name) Returns whether a field with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | bool | | ### array all() Returns the children. #### Return Value | | | | --- | --- | | array | | ### count() {@inheritdoc} ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getForm() Creates the form. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface")[] getIterator() {@inheritdoc} #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface")[] | |
programming_docs
symfony FormExtensionInterface FormExtensionInterface ======================= interface **FormExtensionInterface** Interface for extensions which provide types, type extensions and a guesser. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | | Details ------- ### [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | symfony SubmitButtonTypeInterface SubmitButtonTypeInterface ========================== interface **SubmitButtonTypeInterface** implements [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") A type that should be converted into a {@link SubmitButton} instance. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [FormTypeInterface](formtypeinterface#method_buildForm "Symfony\Component\Form\FormTypeInterface") | | | [buildView](#method_buildView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [FormTypeInterface](formtypeinterface#method_buildView "Symfony\Component\Form\FormTypeInterface") | | | [finishView](#method_finishView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [FormTypeInterface](formtypeinterface#method_finishView "Symfony\Component\Form\FormTypeInterface") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [FormTypeInterface](formtypeinterface#method_configureOptions "Symfony\Component\Form\FormTypeInterface") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | from [FormTypeInterface](formtypeinterface#method_getBlockPrefix "Symfony\Component\Form\FormTypeInterface") | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [FormTypeInterface](formtypeinterface#method_getParent "Symfony\Component\Form\FormTypeInterface") | Details ------- ### buildForm([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::buildForm](formtypeextensioninterface#method_buildForm "Symfony\Component\Form\FormTypeExtensionInterface") | | ### buildView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::buildView](formtypeextensioninterface#method_buildView "Symfony\Component\Form\FormTypeExtensionInterface") | | ### finishView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::finishView](formtypeextensioninterface#method_finishView "Symfony\Component\Form\FormTypeExtensionInterface") | | ### configureOptions([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony Symfony\Component\Form\Test Symfony\Component\Form\Test =========================== Namespaces ---------- [Symfony\Component\Form\Test\Traits](test/traits) Classes ------- | | | | --- | --- | | [FormIntegrationTestCase](test/formintegrationtestcase "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [FormPerformanceTestCase](test/formperformancetestcase "Symfony\Component\Form\Test\FormPerformanceTestCase") | Base class for performance tests. | | [TypeTestCase](test/typetestcase "Symfony\Component\Form\Test\TypeTestCase") | | Interfaces ---------- | | | | --- | --- | | *[FormBuilderInterface](test/formbuilderinterface "Symfony\Component\Form\Test\FormBuilderInterface")* | | | *[FormInterface](test/forminterface "Symfony\Component\Form\Test\FormInterface")* | | symfony AbstractExtension AbstractExtension ================== abstract class **AbstractExtension** implements [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface") Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | | Details ------- ### [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### protected [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | symfony FormRegistry FormRegistry ============= class **FormRegistry** implements [FormRegistryInterface](formregistryinterface "Symfony\Component\Form\FormRegistryInterface") The central registry of the Form component. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $extensions, [ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $resolvedTypeFactory) | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)(string $name) Returns a form type by name. | | | bool | [hasType](#method_hasType)(string $name) Returns whether the given form type is supported. | | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the guesser responsible for guessing types. | | | [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface")[] | [getExtensions](#method_getExtensions)() Returns the extensions loaded by the framework. | | Details ------- ### \_\_construct(array $extensions, [ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $resolvedTypeFactory) #### Parameters | | | | | --- | --- | --- | | array | $extensions | An array of FormExtensionInterface | | [ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") | $resolvedTypeFactory | The factory for resolved form types | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if any extension does not implement FormExtensionInterface | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType(string $name) Returns a form type by name. This methods registers the type extensions from the form extensions. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the type can not be retrieved from any extension | ### bool hasType(string $name) Returns whether the given form type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported | ### [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the guesser responsible for guessing types. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | | ### [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface")[] getExtensions() Returns the extensions loaded by the framework. #### Return Value | | | | --- | --- | | [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface")[] | | symfony SubmitButtonBuilder SubmitButtonBuilder ==================== class **SubmitButtonBuilder** extends [ButtonBuilder](buttonbuilder "Symfony\Component\Form\ButtonBuilder") A builder for {@link SubmitButton} instances. Properties ---------- | | | | | | --- | --- | --- | --- | | protected bool | $locked | | from [ButtonBuilder](buttonbuilder#property_locked "Symfony\Component\Form\ButtonBuilder") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|null $name, array $options = array()) | from [ButtonBuilder](buttonbuilder#method___construct "Symfony\Component\Form\ButtonBuilder") | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [add](#method_add)(string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_add "Symfony\Component\Form\ButtonBuilder") | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [create](#method_create)(string $name, string|null $type = null, array $options = array()) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_create "Symfony\Component\Form\ButtonBuilder") | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [get](#method_get)(string $name) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_get "Symfony\Component\Form\ButtonBuilder") | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [remove](#method_remove)(string $name) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_remove "Symfony\Component\Form\ButtonBuilder") | | bool | [has](#method_has)(string $name) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_has "Symfony\Component\Form\ButtonBuilder") | | array | [all](#method_all)() Returns the children. | from [ButtonBuilder](buttonbuilder#method_all "Symfony\Component\Form\ButtonBuilder") | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getForm](#method_getForm)() Creates the button. | | | $this | [addEventListener](#method_addEventListener)(string $eventName, callable $listener, int $priority = 0) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_addEventListener "Symfony\Component\Form\ButtonBuilder") | | $this | [addEventSubscriber](#method_addEventSubscriber)([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_addEventSubscriber "Symfony\Component\Form\ButtonBuilder") | | $this | [addViewTransformer](#method_addViewTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_addViewTransformer "Symfony\Component\Form\ButtonBuilder") | | $this | [resetViewTransformers](#method_resetViewTransformers)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_resetViewTransformers "Symfony\Component\Form\ButtonBuilder") | | $this | [addModelTransformer](#method_addModelTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_addModelTransformer "Symfony\Component\Form\ButtonBuilder") | | $this | [resetModelTransformers](#method_resetModelTransformers)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_resetModelTransformers "Symfony\Component\Form\ButtonBuilder") | | $this | [setAttribute](#method_setAttribute)(string $name, mixed $value) Sets the value for an attribute. | from [ButtonBuilder](buttonbuilder#method_setAttribute "Symfony\Component\Form\ButtonBuilder") | | $this | [setAttributes](#method_setAttributes)(array $attributes) Sets the attributes. | from [ButtonBuilder](buttonbuilder#method_setAttributes "Symfony\Component\Form\ButtonBuilder") | | $this | [setDataMapper](#method_setDataMapper)([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setDataMapper "Symfony\Component\Form\ButtonBuilder") | | $this | [setDisabled](#method_setDisabled)(bool $disabled) Set whether the button is disabled. | from [ButtonBuilder](buttonbuilder#method_setDisabled "Symfony\Component\Form\ButtonBuilder") | | $this | [setEmptyData](#method_setEmptyData)(mixed $emptyData) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setEmptyData "Symfony\Component\Form\ButtonBuilder") | | $this | [setErrorBubbling](#method_setErrorBubbling)(bool $errorBubbling) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setErrorBubbling "Symfony\Component\Form\ButtonBuilder") | | $this | [setRequired](#method_setRequired)(bool $required) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setRequired "Symfony\Component\Form\ButtonBuilder") | | $this | [setPropertyPath](#method_setPropertyPath)(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setPropertyPath "Symfony\Component\Form\ButtonBuilder") | | $this | [setMapped](#method_setMapped)(bool $mapped) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setMapped "Symfony\Component\Form\ButtonBuilder") | | $this | [setByReference](#method_setByReference)(bool $byReference) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setByReference "Symfony\Component\Form\ButtonBuilder") | | $this | [setCompound](#method_setCompound)(bool $compound) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setCompound "Symfony\Component\Form\ButtonBuilder") | | $this | [setType](#method_setType)([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Sets the type of the button. | from [ButtonBuilder](buttonbuilder#method_setType "Symfony\Component\Form\ButtonBuilder") | | $this | [setData](#method_setData)(mixed $data) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setData "Symfony\Component\Form\ButtonBuilder") | | $this | [setDataLocked](#method_setDataLocked)(bool $locked) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setDataLocked "Symfony\Component\Form\ButtonBuilder") | | | [setFormFactory](#method_setFormFactory)([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setFormFactory "Symfony\Component\Form\ButtonBuilder") | | $this | [setAction](#method_setAction)(string $action) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setAction "Symfony\Component\Form\ButtonBuilder") | | $this | [setMethod](#method_setMethod)(string $method) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setMethod "Symfony\Component\Form\ButtonBuilder") | | $this | [setRequestHandler](#method_setRequestHandler)([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setRequestHandler "Symfony\Component\Form\ButtonBuilder") | | $this | [setAutoInitialize](#method_setAutoInitialize)(bool $initialize) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setAutoInitialize "Symfony\Component\Form\ButtonBuilder") | | $this | [setInheritData](#method_setInheritData)(bool $inheritData) Unsupported method. | from [ButtonBuilder](buttonbuilder#method_setInheritData "Symfony\Component\Form\ButtonBuilder") | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getFormConfig](#method_getFormConfig)() Builds and returns the button configuration. | from [ButtonBuilder](buttonbuilder#method_getFormConfig "Symfony\Component\Form\ButtonBuilder") | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getEventDispatcher "Symfony\Component\Form\ButtonBuilder") | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | from [ButtonBuilder](buttonbuilder#method_getName "Symfony\Component\Form\ButtonBuilder") | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getPropertyPath "Symfony\Component\Form\ButtonBuilder") | | bool | [getMapped](#method_getMapped)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getMapped "Symfony\Component\Form\ButtonBuilder") | | bool | [getByReference](#method_getByReference)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getByReference "Symfony\Component\Form\ButtonBuilder") | | bool | [getCompound](#method_getCompound)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getCompound "Symfony\Component\Form\ButtonBuilder") | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form type used to construct the button. | from [ButtonBuilder](buttonbuilder#method_getType "Symfony\Component\Form\ButtonBuilder") | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getViewTransformers "Symfony\Component\Form\ButtonBuilder") | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getModelTransformers "Symfony\Component\Form\ButtonBuilder") | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getDataMapper "Symfony\Component\Form\ButtonBuilder") | | bool | [getRequired](#method_getRequired)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getRequired "Symfony\Component\Form\ButtonBuilder") | | bool | [getDisabled](#method_getDisabled)() Returns whether the button is disabled. | from [ButtonBuilder](buttonbuilder#method_getDisabled "Symfony\Component\Form\ButtonBuilder") | | bool | [getErrorBubbling](#method_getErrorBubbling)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getErrorBubbling "Symfony\Component\Form\ButtonBuilder") | | mixed | [getEmptyData](#method_getEmptyData)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getEmptyData "Symfony\Component\Form\ButtonBuilder") | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the button. | from [ButtonBuilder](buttonbuilder#method_getAttributes "Symfony\Component\Form\ButtonBuilder") | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | from [ButtonBuilder](buttonbuilder#method_hasAttribute "Symfony\Component\Form\ButtonBuilder") | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | from [ButtonBuilder](buttonbuilder#method_getAttribute "Symfony\Component\Form\ButtonBuilder") | | mixed | [getData](#method_getData)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getData "Symfony\Component\Form\ButtonBuilder") | | string|null | [getDataClass](#method_getDataClass)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getDataClass "Symfony\Component\Form\ButtonBuilder") | | bool | [getDataLocked](#method_getDataLocked)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getDataLocked "Symfony\Component\Form\ButtonBuilder") | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getFormFactory "Symfony\Component\Form\ButtonBuilder") | | string | [getAction](#method_getAction)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getAction "Symfony\Component\Form\ButtonBuilder") | | string | [getMethod](#method_getMethod)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getMethod "Symfony\Component\Form\ButtonBuilder") | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getRequestHandler "Symfony\Component\Form\ButtonBuilder") | | bool | [getAutoInitialize](#method_getAutoInitialize)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getAutoInitialize "Symfony\Component\Form\ButtonBuilder") | | bool | [getInheritData](#method_getInheritData)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getInheritData "Symfony\Component\Form\ButtonBuilder") | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the button. | from [ButtonBuilder](buttonbuilder#method_getOptions "Symfony\Component\Form\ButtonBuilder") | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | from [ButtonBuilder](buttonbuilder#method_hasOption "Symfony\Component\Form\ButtonBuilder") | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | from [ButtonBuilder](buttonbuilder#method_getOption "Symfony\Component\Form\ButtonBuilder") | | int | [count](#method_count)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_count "Symfony\Component\Form\ButtonBuilder") | | [EmptyIterator](http://php.net/EmptyIterator) | [getIterator](#method_getIterator)() Unsupported method. | from [ButtonBuilder](buttonbuilder#method_getIterator "Symfony\Component\Form\ButtonBuilder") | Details ------- ### \_\_construct(string|null $name, array $options = array()) #### Parameters | | | | | --- | --- | --- | | string|null | $name | | | array | $options | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the name is empty | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") add(string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $child | | | string|null | $type | | | array | $options | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") create(string $name, string|null $type = null, array $options = array()) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the form or the name of the property | | string|null | $type | The type of the form or null if name is a property | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") get(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") remove(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool has(string $name) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | bool | | ### array all() Returns the children. #### Return Value | | | | --- | --- | | array | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getForm() Creates the button. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form | ### $this addEventListener(string $eventName, callable $listener, int $priority = 0) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $eventName | The name of the event to listen to | | callable | $listener | The listener to execute | | int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this addEventSubscriber([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") | $subscriber | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this addViewTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $viewTransformer | | | bool | $forcePrepend | If set to true, prepend instead of appending | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this resetViewTransformers() Unsupported method. This method should not be invoked. #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this addModelTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $modelTransformer | | | bool | $forceAppend | If set to true, append instead of prepending | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this resetModelTransformers() Unsupported method. This method should not be invoked. #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setAttribute(string $name, mixed $value) Sets the value for an attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the attribute | | mixed | $value | The value of the attribute | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttributes(array $attributes) Sets the attributes. #### Parameters | | | | | --- | --- | --- | | array | $attributes | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataMapper([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") | $dataMapper | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setDisabled(bool $disabled) Set whether the button is disabled. #### Parameters | | | | | --- | --- | --- | | bool | $disabled | Whether the form is disabled | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setEmptyData(mixed $emptyData) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $emptyData | The empty data | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setErrorBubbling(bool $errorBubbling) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $errorBubbling | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setRequired(bool $required) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $required | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setPropertyPath(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setMapped(bool $mapped) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $mapped | Whether the form should be mapped | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setByReference(bool $byReference) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $byReference | Whether the data should be modified by reference | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setCompound(bool $compound) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $compound | Whether the form should be compound | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setType([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Sets the type of the button. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setData(mixed $data) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The data of the form in application format | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setDataLocked(bool $locked) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $locked | Whether to lock the default data | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### setFormFactory([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $formFactory | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setAction(string $action) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $action | The target URL of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setMethod(string $method) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $method | The HTTP method of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setRequestHandler([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Unsupported method. #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setAutoInitialize(bool $initialize) Unsupported method. #### Parameters | | | | | --- | --- | --- | | bool | $initialize | true to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setInheritData(bool $inheritData) Unsupported method. #### Parameters | | | | | --- | --- | --- | | bool | $inheritData | Whether the form should inherit its parent's data | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getFormConfig() Builds and returns the button configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | | ### [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Unsupported method. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Unsupported method. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getCompound() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form type used to construct the button. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Unsupported method. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Unsupported method. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Unsupported method. #### Return Value | | | | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the button is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the button. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Unsupported method. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Unsupported method. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Unsupported method. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Unsupported method. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Unsupported method. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Unsupported method. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### bool getInheritData() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### array getOptions() Returns all options passed during the construction of the button. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value | ### int count() Unsupported method. #### Return Value | | | | --- | --- | | int | Always returns 0 | ### [EmptyIterator](http://php.net/EmptyIterator) getIterator() Unsupported method. #### Return Value | | | | --- | --- | | [EmptyIterator](http://php.net/EmptyIterator) | Always returns an empty iterator |
programming_docs
symfony NativeRequestHandler NativeRequestHandler ===================== class **NativeRequestHandler** implements [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") A request handler using PHP's super globals $\_GET, $\_POST and $\_SERVER. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ServerParams](util/serverparams "Symfony\Component\Form\Util\ServerParams") $params = null) | | | | [handleRequest](#method_handleRequest)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, mixed $request = null) Submits a form if it was submitted. | | | bool | [isFileUpload](#method_isFileUpload)(mixed $data) Returns true if the given data is a file upload. | | Details ------- ### \_\_construct([ServerParams](util/serverparams "Symfony\Component\Form\Util\ServerParams") $params = null) #### Parameters | | | | | --- | --- | --- | | [ServerParams](util/serverparams "Symfony\Component\Form\Util\ServerParams") | $params | | ### handleRequest([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, mixed $request = null) Submits a form if it was submitted. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form to submit | | mixed | $request | The current request | ### bool isFileUpload(mixed $data) Returns true if the given data is a file upload. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The form field data | #### Return Value | | | | --- | --- | | bool | | symfony FormTypeGuesserInterface FormTypeGuesserInterface ========================= interface **FormTypeGuesserInterface** Methods ------- | | | | | --- | --- | --- | | [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | [guessType](#method_guessType)(string $class, string $property) Returns a field guess for a property name of a class. | | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | [guessRequired](#method_guessRequired)(string $class, string $property) Returns a guess whether a property of a class is required. | | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessMaxLength](#method_guessMaxLength)(string $class, string $property) Returns a guess about the field's maximum length. | | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessPattern](#method_guessPattern)(string $class, string $property) Returns a guess about the field's pattern. | | Details ------- ### [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null guessType(string $class, string $property) Returns a field guess for a property name of a class. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | A guess for the field's type and options | ### [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") guessRequired(string $class, string $property) Returns a guess whether a property of a class is required. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | A guess for the field's required setting | ### [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessMaxLength(string $class, string $property) Returns a guess about the field's maximum length. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | A guess for the field's maximum length | ### [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessPattern(string $class, string $property) Returns a guess about the field's pattern. * When you have a min value, you guess a min length of this min (LOW\_CONFIDENCE) , lines below * If this value is a float type, this is wrong so you guess null with MEDIUM\_CONFIDENCE to override the previous guess. Example: You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5) #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | A guess for the field's required pattern | #### See also | | | | --- | --- | | <https://github.com/symfony/symfony/pull/3927> | | symfony FormView FormView ========= class **FormView** implements [ArrayAccess](http://php.net/ArrayAccess), [IteratorAggregate](http://php.net/IteratorAggregate), [Countable](http://php.net/Countable) Properties ---------- | | | | | | --- | --- | --- | --- | | | $vars | The variables assigned to this view. | | | | $parent | The parent view. | | | [FormView](formview "Symfony\Component\Form\FormView")[] | $children | The child views. | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormView](formview "Symfony\Component\Form\FormView") $parent = null) | | | bool | [isRendered](#method_isRendered)() Returns whether the view was already rendered. | | | $this | [setRendered](#method_setRendered)() Marks the view as rendered. | | | bool | [isMethodRendered](#method_isMethodRendered)() | | | | [setMethodRendered](#method_setMethodRendered)() | | | [FormView](formview "Symfony\Component\Form\FormView") | [offsetGet](#method_offsetGet)(string $name) Returns a child by name (implements \ArrayAccess). | | | bool | [offsetExists](#method_offsetExists)(string $name) Returns whether the given child exists (implements \ArrayAccess). | | | | [offsetSet](#method_offsetSet)($name, $value) Implements \ArrayAccess. | | | | [offsetUnset](#method_offsetUnset)(string $name) Removes a child (implements \ArrayAccess). | | | [ArrayIterator](http://php.net/ArrayIterator)|[FormView](formview "Symfony\Component\Form\FormView")[] | [getIterator](#method_getIterator)() Returns an iterator to iterate over children (implements \IteratorAggregate). | | | int | [count](#method_count)() Implements \Countable. | | Details ------- ### \_\_construct([FormView](formview "Symfony\Component\Form\FormView") $parent = null) #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $parent | | ### bool isRendered() Returns whether the view was already rendered. #### Return Value | | | | --- | --- | | bool | Whether this view's widget is rendered | ### $this setRendered() Marks the view as rendered. #### Return Value | | | | --- | --- | | $this | | ### bool isMethodRendered() #### Return Value | | | | --- | --- | | bool | | ### setMethodRendered() ### [FormView](formview "Symfony\Component\Form\FormView") offsetGet(string $name) Returns a child by name (implements \ArrayAccess). #### Parameters | | | | | --- | --- | --- | | string | $name | The child name | #### Return Value | | | | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | The child view | ### bool offsetExists(string $name) Returns whether the given child exists (implements \ArrayAccess). #### Parameters | | | | | --- | --- | --- | | string | $name | The child name | #### Return Value | | | | --- | --- | | bool | Whether the child view exists | ### offsetSet($name, $value) Implements \ArrayAccess. #### Parameters | | | | | --- | --- | --- | | | $name | | | | $value | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | always as setting a child by name is not allowed | ### offsetUnset(string $name) Removes a child (implements \ArrayAccess). #### Parameters | | | | | --- | --- | --- | | string | $name | The child name | ### [ArrayIterator](http://php.net/ArrayIterator)|[FormView](formview "Symfony\Component\Form\FormView")[] getIterator() Returns an iterator to iterate over children (implements \IteratorAggregate). #### Return Value | | | | --- | --- | | [ArrayIterator](http://php.net/ArrayIterator)|[FormView](formview "Symfony\Component\Form\FormView")[] | The iterator | ### int count() Implements \Countable. #### Return Value | | | | --- | --- | | int | The number of children views | symfony ButtonBuilder ButtonBuilder ============== class **ButtonBuilder** implements [IteratorAggregate](http://php.net/IteratorAggregate), [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") A builder for {@link Button} instances. Properties ---------- | | | | | | --- | --- | --- | --- | | protected bool | $locked | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|null $name, array $options = array()) | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [add](#method_add)(string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Unsupported method. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [create](#method_create)(string $name, string|null $type = null, array $options = array()) Unsupported method. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [get](#method_get)(string $name) Unsupported method. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [remove](#method_remove)(string $name) Unsupported method. | | | bool | [has](#method_has)(string $name) Unsupported method. | | | array | [all](#method_all)() Returns the children. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getForm](#method_getForm)() Creates the button. | | | $this | [addEventListener](#method_addEventListener)(string $eventName, callable $listener, int $priority = 0) Unsupported method. | | | $this | [addEventSubscriber](#method_addEventSubscriber)([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Unsupported method. | | | $this | [addViewTransformer](#method_addViewTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Unsupported method. | | | $this | [resetViewTransformers](#method_resetViewTransformers)() Unsupported method. | | | $this | [addModelTransformer](#method_addModelTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Unsupported method. | | | $this | [resetModelTransformers](#method_resetModelTransformers)() Unsupported method. | | | $this | [setAttribute](#method_setAttribute)(string $name, mixed $value) Sets the value for an attribute. | | | $this | [setAttributes](#method_setAttributes)(array $attributes) Sets the attributes. | | | $this | [setDataMapper](#method_setDataMapper)([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Unsupported method. | | | $this | [setDisabled](#method_setDisabled)(bool $disabled) Set whether the button is disabled. | | | $this | [setEmptyData](#method_setEmptyData)(mixed $emptyData) Unsupported method. | | | $this | [setErrorBubbling](#method_setErrorBubbling)(bool $errorBubbling) Unsupported method. | | | $this | [setRequired](#method_setRequired)(bool $required) Unsupported method. | | | $this | [setPropertyPath](#method_setPropertyPath)(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Unsupported method. | | | $this | [setMapped](#method_setMapped)(bool $mapped) Unsupported method. | | | $this | [setByReference](#method_setByReference)(bool $byReference) Unsupported method. | | | $this | [setCompound](#method_setCompound)(bool $compound) Unsupported method. | | | $this | [setType](#method_setType)([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Sets the type of the button. | | | $this | [setData](#method_setData)(mixed $data) Unsupported method. | | | $this | [setDataLocked](#method_setDataLocked)(bool $locked) Unsupported method. | | | | [setFormFactory](#method_setFormFactory)([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Unsupported method. | | | $this | [setAction](#method_setAction)(string $action) Unsupported method. | | | $this | [setMethod](#method_setMethod)(string $method) Unsupported method. | | | $this | [setRequestHandler](#method_setRequestHandler)([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Unsupported method. | | | $this | [setAutoInitialize](#method_setAutoInitialize)(bool $initialize) Unsupported method. | | | $this | [setInheritData](#method_setInheritData)(bool $inheritData) Unsupported method. | | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getFormConfig](#method_getFormConfig)() Builds and returns the button configuration. | | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Unsupported method. | | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Unsupported method. | | | bool | [getMapped](#method_getMapped)() Unsupported method. | | | bool | [getByReference](#method_getByReference)() Unsupported method. | | | bool | [getCompound](#method_getCompound)() Unsupported method. | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form type used to construct the button. | | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Unsupported method. | | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Unsupported method. | | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Unsupported method. | | | bool | [getRequired](#method_getRequired)() Unsupported method. | | | bool | [getDisabled](#method_getDisabled)() Returns whether the button is disabled. | | | bool | [getErrorBubbling](#method_getErrorBubbling)() Unsupported method. | | | mixed | [getEmptyData](#method_getEmptyData)() Unsupported method. | | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the button. | | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | | | mixed | [getData](#method_getData)() Unsupported method. | | | string|null | [getDataClass](#method_getDataClass)() Unsupported method. | | | bool | [getDataLocked](#method_getDataLocked)() Unsupported method. | | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Unsupported method. | | | string | [getAction](#method_getAction)() Unsupported method. | | | string | [getMethod](#method_getMethod)() Unsupported method. | | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Unsupported method. | | | bool | [getAutoInitialize](#method_getAutoInitialize)() Unsupported method. | | | bool | [getInheritData](#method_getInheritData)() Unsupported method. | | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the button. | | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | | | int | [count](#method_count)() Unsupported method. | | | [EmptyIterator](http://php.net/EmptyIterator) | [getIterator](#method_getIterator)() Unsupported method. | | Details ------- ### \_\_construct(string|null $name, array $options = array()) #### Parameters | | | | | --- | --- | --- | | string|null | $name | | | array | $options | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the name is empty | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") add(string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string|int|[FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $child | | | string|null | $type | | | array | $options | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") create(string $name, string|null $type = null, array $options = array()) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the form or the name of the property | | string|null | $type | The type of the form or null if name is a property | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") get(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") remove(string $name) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool has(string $name) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | bool | | ### array all() Returns the children. #### Return Value | | | | --- | --- | | array | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getForm() Creates the button. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form | ### $this addEventListener(string $eventName, callable $listener, int $priority = 0) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string | $eventName | The name of the event to listen to | | callable | $listener | The listener to execute | | int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this addEventSubscriber([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") | $subscriber | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this addViewTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $viewTransformer | | | bool | $forcePrepend | If set to true, prepend instead of appending | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this resetViewTransformers() Unsupported method. This method should not be invoked. #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this addModelTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $modelTransformer | | | bool | $forceAppend | If set to true, append instead of prepending | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this resetModelTransformers() Unsupported method. This method should not be invoked. #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setAttribute(string $name, mixed $value) Sets the value for an attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the attribute | | mixed | $value | The value of the attribute | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttributes(array $attributes) Sets the attributes. #### Parameters | | | | | --- | --- | --- | | array | $attributes | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataMapper([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") | $dataMapper | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setDisabled(bool $disabled) Set whether the button is disabled. #### Parameters | | | | | --- | --- | --- | | bool | $disabled | Whether the form is disabled | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setEmptyData(mixed $emptyData) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $emptyData | The empty data | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setErrorBubbling(bool $errorBubbling) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $errorBubbling | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setRequired(bool $required) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $required | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setPropertyPath(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setMapped(bool $mapped) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $mapped | Whether the form should be mapped | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setByReference(bool $byReference) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $byReference | Whether the data should be modified by reference | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setCompound(bool $compound) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $compound | Whether the form should be compound | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setType([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Sets the type of the button. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setData(mixed $data) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The data of the form in application format | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setDataLocked(bool $locked) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | bool | $locked | Whether to lock the default data | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### setFormFactory([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Unsupported method. This method should not be invoked. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $formFactory | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setAction(string $action) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $action | The target URL of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setMethod(string $method) Unsupported method. #### Parameters | | | | | --- | --- | --- | | string | $method | The HTTP method of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setRequestHandler([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Unsupported method. #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setAutoInitialize(bool $initialize) Unsupported method. #### Parameters | | | | | --- | --- | --- | | bool | $initialize | true to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### $this setInheritData(bool $inheritData) Unsupported method. #### Parameters | | | | | --- | --- | --- | | bool | $inheritData | Whether the form should inherit its parent's data | #### Return Value | | | | --- | --- | | $this | The configuration object | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getFormConfig() Builds and returns the button configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | | ### [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Unsupported method. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Unsupported method. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getCompound() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form type used to construct the button. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Unsupported method. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Unsupported method. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Unsupported method. #### Return Value | | | | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the button is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the button. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Unsupported method. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Unsupported method. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Unsupported method. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Unsupported method. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Unsupported method. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Unsupported method. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Unsupported method. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### bool getInheritData() Unsupported method. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### array getOptions() Returns all options passed during the construction of the button. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value | ### int count() Unsupported method. #### Return Value | | | | --- | --- | | int | Always returns 0 | ### [EmptyIterator](http://php.net/EmptyIterator) getIterator() Unsupported method. #### Return Value | | | | --- | --- | | [EmptyIterator](http://php.net/EmptyIterator) | Always returns an empty iterator |
programming_docs
symfony Symfony\Component\Form\DependencyInjection Symfony\Component\Form\DependencyInjection ========================================== Classes ------- | | | | --- | --- | | [FormPass](dependencyinjection/formpass "Symfony\Component\Form\DependencyInjection\FormPass") | Adds all services with the tags "form.type", "form.type\_extension" and "form.type\_guesser" as arguments of the "form.extension" service. | symfony ResolvedFormType ResolvedFormType ================= class **ResolvedFormType** implements [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") A wrapper for a form type and its extensions. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $innerType, array $typeExtensions = array(), [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface")|null | [getParent](#method_getParent)() Returns the parent type. | | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getInnerType](#method_getInnerType)() Returns the wrapped form type. | | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)() Returns the extensions of the wrapped form type. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createBuilder](#method_createBuilder)([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, string $name, array $options = array()) Creates a new form builder for this type. | | | [FormView](formview "Symfony\Component\Form\FormView") | [createView](#method_createView)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a new form view for a form of this type. | | | | [buildForm](#method_buildForm)([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Configures a form builder for the type hierarchy. | | | | [buildView](#method_buildView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Configures a form view for the type hierarchy. | | | | [finishView](#method_finishView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes a form view for the type hierarchy. | | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | [getOptionsResolver](#method_getOptionsResolver)() Returns the configured options resolver used for this type. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [newBuilder](#method_newBuilder)(string $name, string $dataClass, [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, array $options) Creates a new builder instance. | | | [FormView](formview "Symfony\Component\Form\FormView") | [newView](#method_newView)([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a new view instance. | | Details ------- ### \_\_construct([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $innerType, array $typeExtensions = array(), [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) #### Parameters | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | $innerType | | | array | $typeExtensions | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $parent | | ### string getBlockPrefix() Returns the prefix of the template block name for this type. #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface")|null getParent() Returns the parent type. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface")|null | The parent type or null | ### [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") getInnerType() Returns the wrapped form type. #### Return Value | | | | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The wrapped form type | ### [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions() Returns the extensions of the wrapped form type. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of {@link FormTypeExtensionInterface} instances | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createBuilder([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, string $name, array $options = array()) Creates a new form builder for this type. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | The form factory | | string | $name | The name for the builder | | array | $options | The builder options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The created form builder | ### [FormView](formview "Symfony\Component\Form\FormView") createView([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a new form view for a form of this type. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form to create a view for | | [FormView](formview "Symfony\Component\Form\FormView") | $parent | The parent view or null | #### Return Value | | | | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | The created form view | ### buildForm([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Configures a form builder for the type hierarchy. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The builder to configure | | array | $options | The options used for the configuration | ### buildView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Configures a form view for the type hierarchy. This method is called before the children of the view are built. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The form view to configure | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form corresponding to the view | | array | $options | The options used for the configuration | ### finishView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes a form view for the type hierarchy. This method is called after the children of the view have been built. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The form view to configure | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form corresponding to the view | | array | $options | The options used for the configuration | ### [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") getOptionsResolver() Returns the configured options resolver used for this type. #### Return Value | | | | --- | --- | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | The options resolver | ### protected [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") newBuilder(string $name, string $dataClass, [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, array $options) Creates a new builder instance. Override this method if you want to customize the builder class. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the builder | | string | $dataClass | The data class | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | The current form factory | | array | $options | The builder options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The new builder instance | ### protected [FormView](formview "Symfony\Component\Form\FormView") newView([FormView](formview "Symfony\Component\Form\FormView") $parent = null) Creates a new view instance. Override this method if you want to customize the view class. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $parent | The parent view, if available | #### Return Value | | | | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | A new view instance | symfony FormErrorIterator FormErrorIterator ================== class **FormErrorIterator** implements [RecursiveIterator](http://php.net/RecursiveIterator), [SeekableIterator](http://php.net/SeekableIterator), [ArrayAccess](http://php.net/ArrayAccess), [Countable](http://php.net/Countable) Iterates over the errors of a form. Optionally, this class supports recursive iteration. In order to iterate recursively, set the constructor argument $deep to true. Now each element returned by the iterator is either an instance of {@link FormError} or of {@link FormErrorIterator}, in case the errors belong to a sub-form. You can also wrap the iterator into a {@link \RecursiveIteratorIterator} to flatten the recursive structure into a flat list of errors. Constants --------- | | | | --- | --- | | INDENTATION | *The prefix used for indenting nested error messages.* | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $errors) Creates a new iterator. | | | string | [\_\_toString](#method___toString)() Returns all iterated error messages as string. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [getForm](#method_getForm)() Returns the iterated form. | | | [FormError](formerror "Symfony\Component\Form\FormError")|[FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | [current](#method_current)() Returns the current element of the iterator. | | | | [next](#method_next)() Advances the iterator to the next position. | | | int | [key](#method_key)() Returns the current position of the iterator. | | | bool | [valid](#method_valid)() Returns whether the iterator's position is valid. | | | | [rewind](#method_rewind)() Sets the iterator's position to the beginning. | | | bool | [offsetExists](#method_offsetExists)(int $position) Returns whether a position exists in the iterator. | | | [FormError](formerror "Symfony\Component\Form\FormError")|[FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | [offsetGet](#method_offsetGet)(int $position) Returns the element at a position in the iterator. | | | | [offsetSet](#method_offsetSet)($position, $value) Unsupported method. | | | | [offsetUnset](#method_offsetUnset)($position) Unsupported method. | | | bool | [hasChildren](#method_hasChildren)() Returns whether the current element of the iterator can be recursed into. | | | | [getChildren](#method_getChildren)() Alias of {@link current()}. | | | int | [count](#method_count)() Returns the number of elements in the iterator. | | | | [seek](#method_seek)(int $position) Sets the position of the iterator. | | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | [findByCodes](#method_findByCodes)(string|string[] $codes) Creates iterator for errors with specific codes. | | Details ------- ### \_\_construct([FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $errors) Creates a new iterator. #### Parameters | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The erroneous form | | array | $errors | The form errors | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | If the errors are invalid | ### string \_\_toString() Returns all iterated error messages as string. #### Return Value | | | | --- | --- | | string | The iterated error messages | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") getForm() Returns the iterated form. #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form whose errors are iterated by this object | ### [FormError](formerror "Symfony\Component\Form\FormError")|[FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") current() Returns the current element of the iterator. #### Return Value | | | | --- | --- | | [FormError](formerror "Symfony\Component\Form\FormError")|[FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | an error or an iterator containing nested errors | ### next() Advances the iterator to the next position. ### int key() Returns the current position of the iterator. #### Return Value | | | | --- | --- | | int | The 0-indexed position | ### bool valid() Returns whether the iterator's position is valid. #### Return Value | | | | --- | --- | | bool | Whether the iterator is valid | ### rewind() Sets the iterator's position to the beginning. This method detects if errors have been added to the form since the construction of the iterator. ### bool offsetExists(int $position) Returns whether a position exists in the iterator. #### Parameters | | | | | --- | --- | --- | | int | $position | The position | #### Return Value | | | | --- | --- | | bool | Whether that position exists | ### [FormError](formerror "Symfony\Component\Form\FormError")|[FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") offsetGet(int $position) Returns the element at a position in the iterator. #### Parameters | | | | | --- | --- | --- | | int | $position | The position | #### Return Value | | | | --- | --- | | [FormError](formerror "Symfony\Component\Form\FormError")|[FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | The element at the given position | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](exception/outofboundsexception "Symfony\Component\Form\Exception\OutOfBoundsException") | If the given position does not exist | ### offsetSet($position, $value) Unsupported method. #### Parameters | | | | | --- | --- | --- | | | $position | | | | $value | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### offsetUnset($position) Unsupported method. #### Parameters | | | | | --- | --- | --- | | | $position | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Form\Exception\BadMethodCallException") | | ### bool hasChildren() Returns whether the current element of the iterator can be recursed into. #### Return Value | | | | --- | --- | | bool | Whether the current element is an instance of this class | ### getChildren() Alias of {@link current()}. ### int count() Returns the number of elements in the iterator. Note that this is not the total number of errors, if the constructor parameter $deep was set to true! In that case, you should wrap the iterator into a {@link \RecursiveIteratorIterator} with the standard mode {@link \RecursiveIteratorIterator::LEAVES\_ONLY} and count the result. ``` $iterator = new \RecursiveIteratorIterator($form->getErrors(true)); $count = count(iterator_to_array($iterator)); ``` Alternatively, set the constructor argument $flatten to true as well. ``` $count = count($form->getErrors(true, true)); ``` #### Return Value | | | | --- | --- | | int | The number of iterated elements | ### seek(int $position) Sets the position of the iterator. #### Parameters | | | | | --- | --- | --- | | int | $position | The new position | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](exception/outofboundsexception "Symfony\Component\Form\Exception\OutOfBoundsException") | If the position is invalid | ### [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") findByCodes(string|string[] $codes) Creates iterator for errors with specific codes. #### Parameters | | | | | --- | --- | --- | | string|string[] | $codes | The codes to find | #### Return Value | | | | --- | --- | | [FormErrorIterator](formerroriterator "Symfony\Component\Form\FormErrorIterator") | new instance which contains only specific errors | symfony Symfony\Component\Form\Console Symfony\Component\Form\Console ============================== Namespaces ---------- [Symfony\Component\Form\Console\Descriptor](console/descriptor)[Symfony\Component\Form\Console\Helper](console/helper) symfony FormConfigInterface FormConfigInterface ==================== interface **FormConfigInterface** The configuration of a {@link Form} object. Methods ------- | | | | | --- | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Returns the event dispatcher used to dispatch form events. | | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form should be mapped to. | | | bool | [getMapped](#method_getMapped)() Returns whether the form should be mapped to an element of its parent's data. | | | bool | [getByReference](#method_getByReference)() Returns whether the form's data should be modified by reference. | | | bool | [getInheritData](#method_getInheritData)() Returns whether the form should read and write the data of its parent. | | | bool | [getCompound](#method_getCompound)() Returns whether the form is compound. | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form types used to construct the form. | | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Returns the view transformers of the form. | | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Returns the model transformers of the form. | | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Returns the data mapper of the form. | | | bool | [getRequired](#method_getRequired)() Returns whether the form is required. | | | bool | [getDisabled](#method_getDisabled)() Returns whether the form is disabled. | | | bool | [getErrorBubbling](#method_getErrorBubbling)() Returns whether errors attached to the form will bubble to its parent. | | | mixed | [getEmptyData](#method_getEmptyData)() Returns the data that should be returned when the form is empty. | | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the form. | | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | | | mixed | [getData](#method_getData)() Returns the initial data of the form. | | | string|null | [getDataClass](#method_getDataClass)() Returns the class of the form data or null if the data is scalar or an array. | | | bool | [getDataLocked](#method_getDataLocked)() Returns whether the form's data is locked. | | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Returns the form factory used for creating new forms. | | | string | [getAction](#method_getAction)() Returns the target URL of the form. | | | string | [getMethod](#method_getMethod)() Returns the HTTP method used by the form. | | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Returns the request handler used by the form. | | | bool | [getAutoInitialize](#method_getAutoInitialize)() Returns whether the form should be initialized upon creation. | | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the form. | | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | | Details ------- ### [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Returns the event dispatcher used to dispatch form events. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form should be mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Returns whether the form should be mapped to an element of its parent's data. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Returns whether the form's data should be modified by reference. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getInheritData() Returns whether the form should read and write the data of its parent. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### bool getCompound() Returns whether the form is compound. This property is independent of whether the form actually has children. A form can be compound and have no children at all, like for example an empty collection form. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form types used to construct the form. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Returns the view transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Returns the model transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Returns the data mapper of the form. #### Return Value | | | | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Returns whether the form is required. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the form is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Returns whether errors attached to the form will bubble to its parent. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Returns the data that should be returned when the form is empty. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the form. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Returns the initial data of the form. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Returns the class of the form data or null if the data is scalar or an array. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Returns whether the form's data is locked. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Returns the form factory used for creating new forms. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Returns the target URL of the form. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Returns the HTTP method used by the form. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Returns the request handler used by the form. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Returns whether the form should be initialized upon creation. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### array getOptions() Returns all options passed during the construction of the form. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value |
programming_docs
symfony ResolvedFormTypeFactoryInterface ResolvedFormTypeFactoryInterface ================================= interface **ResolvedFormTypeFactoryInterface** Creates ResolvedFormTypeInterface instances. This interface allows you to use your custom ResolvedFormTypeInterface implementation, within which you can customize the concrete FormBuilderInterface implementations or FormView subclasses that are used by the framework. Methods ------- | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [createResolvedType](#method_createResolvedType)([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type, array $typeExtensions, [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) Resolves a form type. | | Details ------- ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") createResolvedType([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type, array $typeExtensions, [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) Resolves a form type. #### Parameters | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | $type | | | array | $typeExtensions | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $parent | | #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the types parent {@link FormTypeInterface::getParent()} is not a string | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the types parent can not be retrieved from any extension | symfony ResolvedFormTypeFactory ResolvedFormTypeFactory ======================== class **ResolvedFormTypeFactory** implements [ResolvedFormTypeFactoryInterface](resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") Methods ------- | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [createResolvedType](#method_createResolvedType)([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type, array $typeExtensions, [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) Resolves a form type. | | Details ------- ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") createResolvedType([FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type, array $typeExtensions, [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) Resolves a form type. #### Parameters | | | | | --- | --- | --- | | [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") | $type | | | array | $typeExtensions | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $parent | | #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the types parent {@link FormTypeInterface::getParent()} is not a string | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the types parent can not be retrieved from any extension | symfony FormRenderer FormRenderer ============= class **FormRenderer** implements [FormRendererInterface](formrendererinterface "Symfony\Component\Form\FormRendererInterface") Renders a form into HTML using a rendering engine. Constants --------- | | | | --- | --- | | CACHE\_KEY\_VAR | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") $engine, [CsrfTokenManagerInterface](../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $csrfTokenManager = null) | | | [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") | [getEngine](#method_getEngine)() Returns the engine used by this renderer. | | | | [setTheme](#method_setTheme)([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. | | | string | [renderCsrfToken](#method_renderCsrfToken)(string $tokenId) Renders a CSRF token. | | | string | [renderBlock](#method_renderBlock)([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName, array $variables = array()) Renders a named block of the form theme. | | | string | [searchAndRenderBlock](#method_searchAndRenderBlock)([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockNameSuffix, array $variables = array()) Searches and renders a block for a given name suffix. | | | string | [humanize](#method_humanize)(string $text) Makes a technical name human readable. | | | | [encodeCurrency](#method_encodeCurrency)(Environment $environment, $text, $widget = '') | | Details ------- ### \_\_construct([FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") $engine, [CsrfTokenManagerInterface](../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $csrfTokenManager = null) #### Parameters | | | | | --- | --- | --- | | [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") | $engine | | | [CsrfTokenManagerInterface](../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") | $csrfTokenManager | | ### [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") getEngine() Returns the engine used by this renderer. #### Return Value | | | | --- | --- | | [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") | The renderer engine | ### setTheme([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view to assign the theme(s) to | | mixed | $themes | The theme(s). The type of these themes is open to the implementation. | | bool | $useDefaultThemes | If true, will use default themes specified in the renderer | ### string renderCsrfToken(string $tokenId) Renders a CSRF token. Use this helper for CSRF protection without the overhead of creating a form. ``` <input type="hidden" name="token" value="<?php $renderer->renderCsrfToken('rm_user_'.$user->getId()) ?>"> ``` Check the token in your action using the same token ID. ``` // $csrfProvider being an instance of Symfony\Component\Security\Csrf\TokenGenerator\TokenGeneratorInterface if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { throw new \RuntimeException('CSRF attack detected.'); } ``` #### Parameters | | | | | --- | --- | --- | | string | $tokenId | The ID of the CSRF token | #### Return Value | | | | --- | --- | | string | A CSRF token | ### string renderBlock([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName, array $variables = array()) Renders a named block of the form theme. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for which to render the block | | string | $blockName | The name of the block | | array | $variables | The variables to pass to the template | #### Return Value | | | | --- | --- | | string | The HTML markup | ### string searchAndRenderBlock([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockNameSuffix, array $variables = array()) Searches and renders a block for a given name suffix. The block is searched by combining the block names stored in the form view with the given suffix. If a block name is found, that block is rendered. If this method is called recursively, the block search is continued where a block was found before. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view for which to render the block | | string | $blockNameSuffix | The suffix of the block name | | array | $variables | The variables to pass to the template | #### Return Value | | | | --- | --- | | string | The HTML markup | ### string humanize(string $text) Makes a technical name human readable. Sequences of underscores are replaced by single spaces. The first letter of the resulting string is capitalized, while all other letters are turned to lowercase. #### Parameters | | | | | --- | --- | --- | | string | $text | The text to humanize | #### Return Value | | | | --- | --- | | string | The humanized text | ### encodeCurrency(Environment $environment, $text, $widget = '') #### Parameters | | | | | --- | --- | --- | | Environment | $environment | | | | $text | | | | $widget | | symfony FormFactoryInterface FormFactoryInterface ===================== interface **FormFactoryInterface** Methods ------- | | | | | --- | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [create](#method_create)(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [createNamed](#method_createNamed)(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [createForProperty](#method_createForProperty)(string $class, string $property, mixed $data = null, array $options = array()) Returns a form for a property of a class. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createBuilder](#method_createBuilder)(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createNamedBuilder](#method_createNamedBuilder)(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createBuilderForProperty](#method_createBuilderForProperty)(string $class, string $property, mixed $data = null, array $options = array()) Returns a form builder for a property of a class. | | Details ------- ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") create(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. #### Parameters | | | | | --- | --- | --- | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form named after the type | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | #### See also | | | | --- | --- | | createBuilder() | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") createNamed(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The name of the form | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | #### See also | | | | --- | --- | | createNamedBuilder() | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") createForProperty(string $class, string $property, mixed $data = null, array $options = array()) Returns a form for a property of a class. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | | mixed | $data | The initial data | | array | $options | The options for the builder | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form named after the property | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the form type | #### See also | | | | --- | --- | | createBuilderForProperty() | | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createBuilder(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. #### Parameters | | | | | --- | --- | --- | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The form builder | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createNamedBuilder(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The name of the form | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The form builder | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = array()) Returns a form builder for a property of a class. If any of the 'required' and type options can be guessed, and are not provided in the options argument, the guessed value is used. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | | mixed | $data | The initial data | | array | $options | The options for the builder | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The form builder named after the property | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the form type | symfony FormFactory FormFactory ============ class **FormFactory** implements [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormRegistryInterface](formregistryinterface "Symfony\Component\Form\FormRegistryInterface") $registry) | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [create](#method_create)(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [createNamed](#method_createNamed)(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. | | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | [createForProperty](#method_createForProperty)(string $class, string $property, mixed $data = null, array $options = array()) Returns a form for a property of a class. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createBuilder](#method_createBuilder)(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createNamedBuilder](#method_createNamedBuilder)(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. | | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createBuilderForProperty](#method_createBuilderForProperty)(string $class, string $property, mixed $data = null, array $options = array()) Returns a form builder for a property of a class. | | Details ------- ### \_\_construct([FormRegistryInterface](formregistryinterface "Symfony\Component\Form\FormRegistryInterface") $registry) #### Parameters | | | | | --- | --- | --- | | [FormRegistryInterface](formregistryinterface "Symfony\Component\Form\FormRegistryInterface") | $registry | | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") create(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. #### Parameters | | | | | --- | --- | --- | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form named after the type | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") createNamed(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The name of the form | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | ### [FormInterface](forminterface "Symfony\Component\Form\FormInterface") createForProperty(string $class, string $property, mixed $data = null, array $options = array()) Returns a form for a property of a class. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | | mixed | $data | The initial data | | array | $options | The options for the builder | #### Return Value | | | | --- | --- | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | The form named after the property | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the form type | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createBuilder(string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. #### Parameters | | | | | --- | --- | --- | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The form builder | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createNamedBuilder(string|int $name, string $type = 'Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType', mixed $data = null, array $options = array()) Returns a form builder. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The name of the form | | string | $type | The type of the form | | mixed | $data | The initial data | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The form builder | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the given type | ### [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createBuilderForProperty(string $class, string $property, mixed $data = null, array $options = array()) Returns a form builder for a property of a class. If any of the 'required' and type options can be guessed, and are not provided in the options argument, the guessed value is used. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | | mixed | $data | The initial data | | array | $options | The options for the builder | #### Return Value | | | | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The form builder named after the property | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | if any given option is not applicable to the form type |
programming_docs
symfony AbstractRendererEngine AbstractRendererEngine ======================= abstract class **AbstractRendererEngine** implements [FormRendererEngineInterface](formrendererengineinterface "Symfony\Component\Form\FormRendererEngineInterface") Default implementation of {@link FormRendererEngineInterface}. Constants --------- | | | | --- | --- | | CACHE\_KEY\_VAR | *The variable in {@link FormView} used as cache key.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $defaultThemes | | | | protected | $themes | | | | protected | $useDefaultThemes | | | | protected | $resources | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $defaultThemes = array()) Creates a new renderer engine. | | | | [setTheme](#method_setTheme)([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. | | | mixed | [getResourceForBlockName](#method_getResourceForBlockName)([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName) Returns the resource for a block name. | | | mixed | [getResourceForBlockNameHierarchy](#method_getResourceForBlockNameHierarchy)([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the resource for a block hierarchy. | | | int|bool | [getResourceHierarchyLevel](#method_getResourceHierarchyLevel)([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the hierarchy level at which a resource can be found. | | | bool | [loadResourceForBlockName](#method_loadResourceForBlockName)(string $cacheKey, [FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName) Loads the cache with the resource for a given block name. | | Details ------- ### \_\_construct(array $defaultThemes = array()) Creates a new renderer engine. #### Parameters | | | | | --- | --- | --- | | array | $defaultThemes | The default themes. The type of these themes is open to the implementation. | ### setTheme([FormView](formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view to assign the theme(s) to | | mixed | $themes | The theme(s). The type of these themes is open to the implementation. | | bool | $useDefaultThemes | If true, will use default themes specified in the engine | ### mixed getResourceForBlockName([FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName) Returns the resource for a block name. The resource is first searched in the themes attached to $view, then in the themes of its parent view and so on, until a resource was found. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | the view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc | | string | $blockName | The name of the block to render | #### Return Value | | | | --- | --- | | mixed | the renderer resource or false, if none was found | ### mixed getResourceForBlockNameHierarchy([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the resource for a block hierarchy. A block hierarchy is an array which starts with the root of the hierarchy and continues with the child of that root, the child of that child etc. The following is an example for a block hierarchy: ``` form_widget text_widget url_widget ``` In this example, "url\_widget" is the most specific block, while the other blocks are its ancestors in the hierarchy. The second parameter $hierarchyLevel determines the level of the hierarchy that should be rendered. For example, if $hierarchyLevel is 2 for the above hierarchy, the engine will first look for the block "url\_widget", then, if that does not exist, for the block "text\_widget" etc. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | the view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc | | array | $blockNameHierarchy | The block name hierarchy, with the root block at the beginning | | int | $hierarchyLevel | The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy. | #### Return Value | | | | --- | --- | | mixed | The renderer resource or false, if none was found | ### int|bool getResourceHierarchyLevel([FormView](formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the hierarchy level at which a resource can be found. A block hierarchy is an array which starts with the root of the hierarchy and continues with the child of that root, the child of that child etc. The following is an example for a block hierarchy: ``` form_widget text_widget url_widget ``` The second parameter $hierarchyLevel determines the level of the hierarchy that should be rendered. If we call this method with the hierarchy level 2, the engine will first look for a resource for block "url\_widget". If such a resource exists, the method returns 2. Otherwise it tries to find a resource for block "text\_widget" (at level 1) and, again, returns 1 if a resource was found. The method continues to look for resources until the root level was reached and nothing was found. In this case false is returned. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | the view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc | | array | $blockNameHierarchy | The block name hierarchy, with the root block at the beginning | | int | $hierarchyLevel | The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy. | #### Return Value | | | | --- | --- | | int|bool | The hierarchy level or false, if no resource was found | ### abstract protected bool loadResourceForBlockName(string $cacheKey, [FormView](formview "Symfony\Component\Form\FormView") $view, string $blockName) Loads the cache with the resource for a given block name. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The cache key of the form view | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The form view for finding the applying themes | | string | $blockName | The name of the block to load | #### Return Value | | | | --- | --- | | bool | True if the resource could be loaded, false otherwise | #### See also | | | | --- | --- | | getResourceForBlock() | | symfony ButtonTypeInterface ButtonTypeInterface ==================== interface **ButtonTypeInterface** implements [FormTypeInterface](formtypeinterface "Symfony\Component\Form\FormTypeInterface") A type that should be converted into a {@link Button} instance. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [FormTypeInterface](formtypeinterface#method_buildForm "Symfony\Component\Form\FormTypeInterface") | | | [buildView](#method_buildView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [FormTypeInterface](formtypeinterface#method_buildView "Symfony\Component\Form\FormTypeInterface") | | | [finishView](#method_finishView)([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [FormTypeInterface](formtypeinterface#method_finishView "Symfony\Component\Form\FormTypeInterface") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [FormTypeInterface](formtypeinterface#method_configureOptions "Symfony\Component\Form\FormTypeInterface") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | from [FormTypeInterface](formtypeinterface#method_getBlockPrefix "Symfony\Component\Form\FormTypeInterface") | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [FormTypeInterface](formtypeinterface#method_getParent "Symfony\Component\Form\FormTypeInterface") | Details ------- ### buildForm([FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::buildForm](formtypeextensioninterface#method_buildForm "Symfony\Component\Form\FormTypeExtensionInterface") | | ### buildView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::buildView](formtypeextensioninterface#method_buildView "Symfony\Component\Form\FormTypeExtensionInterface") | | ### finishView([FormView](formview "Symfony\Component\Form\FormView") $view, [FormInterface](forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | #### See also | | | | --- | --- | | [FormTypeExtensionInterface::finishView](formtypeextensioninterface#method_finishView "Symfony\Component\Form\FormTypeExtensionInterface") | | ### configureOptions([OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony FormTypeGuesserChain FormTypeGuesserChain ===================== class **FormTypeGuesserChain** implements [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(iterable $guessers) | | | [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | [guessType](#method_guessType)(string $class, string $property) Returns a field guess for a property name of a class. | | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | [guessRequired](#method_guessRequired)(string $class, string $property) Returns a guess whether a property of a class is required. | | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessMaxLength](#method_guessMaxLength)(string $class, string $property) Returns a guess about the field's maximum length. | | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessPattern](#method_guessPattern)(string $class, string $property) Returns a guess about the field's pattern. | | Details ------- ### \_\_construct(iterable $guessers) #### Parameters | | | | | --- | --- | --- | | iterable | $guessers | Guessers as instances of FormTypeGuesserInterface | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if any guesser does not implement FormTypeGuesserInterface | ### [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null guessType(string $class, string $property) Returns a field guess for a property name of a class. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [TypeGuess](guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | A guess for the field's type and options | ### [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") guessRequired(string $class, string $property) Returns a guess whether a property of a class is required. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | A guess for the field's required setting | ### [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessMaxLength(string $class, string $property) Returns a guess about the field's maximum length. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | A guess for the field's maximum length | ### [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessPattern(string $class, string $property) Returns a guess about the field's pattern. * When you have a min value, you guess a min length of this min (LOW\_CONFIDENCE) , lines below * If this value is a float type, this is wrong so you guess null with MEDIUM\_CONFIDENCE to override the previous guess. Example: You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5) #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | A guess for the field's required pattern | symfony FormRegistryInterface FormRegistryInterface ====================== interface **FormRegistryInterface** The central registry of the Form component. Methods ------- | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)(string $name) Returns a form type by name. | | | bool | [hasType](#method_hasType)(string $name) Returns whether the given form type is supported. | | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the guesser responsible for guessing types. | | | [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface")[] | [getExtensions](#method_getExtensions)() Returns the extensions loaded by the framework. | | Details ------- ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType(string $name) Returns a form type by name. This methods registers the type extensions from the form extensions. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the type can not be retrieved from any extension | ### bool hasType(string $name) Returns whether the given form type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported | ### [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the guesser responsible for guessing types. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | | ### [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface")[] getExtensions() Returns the extensions loaded by the framework. #### Return Value | | | | --- | --- | | [FormExtensionInterface](formextensioninterface "Symfony\Component\Form\FormExtensionInterface")[] | |
programming_docs
symfony DataTransformerInterface DataTransformerInterface ========================= interface **DataTransformerInterface** Transforms a value between different representations. Methods ------- | | | | | --- | --- | --- | | mixed | [transform](#method_transform)(mixed $value) Transforms a value from the original representation to a transformed representation. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a value from the transformed representation to its original representation. | | Details ------- ### mixed transform(mixed $value) Transforms a value from the original representation to a transformed representation. This method is called on two occasions inside a form field: 1. When the form field is initialized with the data attached from the datasource (object or array). 2. When data from a request is submitted using {@link Form::submit()} to transform the new input data back into the renderable format. For example if you have a date field and submit '2009-10-10' you might accept this value because its easily parsed, but the transformer still writes back "2009/10/10" onto the form field (for further displaying or other purposes). This method must be able to deal with empty values. Usually this will be NULL, but depending on your implementation other empty values are possible as well (such as empty strings). The reasoning behind this is that value transformers must be chainable. If the transform() method of the first value transformer outputs NULL, the second value transformer must be able to process that value. By convention, transform() should return an empty string if NULL is passed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | ### mixed reverseTransform(mixed $value) Transforms a value from the transformed representation to its original representation. This method is called when {@link Form::submit()} is called to transform the requests tainted data into an acceptable format for your data processing/model layer. This method must be able to deal with empty values. Usually this will be an empty string, but depending on your implementation other empty values are possible as well (such as NULL). The reasoning behind this is that value transformers must be chainable. If the reverseTransform() method of the first value transformer outputs an empty string, the second value transformer must be able to process that value. By convention, reverseTransform() should return NULL if an empty string is passed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | symfony FormConfigBuilder FormConfigBuilder ================== class **FormConfigBuilder** implements [FormConfigBuilderInterface](formconfigbuilderinterface "Symfony\Component\Form\FormConfigBuilderInterface") A basic form configuration. Properties ---------- | | | | | | --- | --- | --- | --- | | protected bool | $locked | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|int $name, string|null $dataClass, [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, array $options = array()) Creates an empty form configuration. | | | $this | [addEventListener](#method_addEventListener)(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. | | | $this | [addEventSubscriber](#method_addEventSubscriber)([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. | | | $this | [addViewTransformer](#method_addViewTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. | | | $this | [resetViewTransformers](#method_resetViewTransformers)() Clears the view transformers. | | | $this | [addModelTransformer](#method_addModelTransformer)([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. | | | $this | [resetModelTransformers](#method_resetModelTransformers)() Clears the normalization transformers. | | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Returns the event dispatcher used to dispatch form events. | | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form should be mapped to. | | | bool | [getMapped](#method_getMapped)() Returns whether the form should be mapped to an element of its parent's data. | | | bool | [getByReference](#method_getByReference)() Returns whether the form's data should be modified by reference. | | | bool | [getInheritData](#method_getInheritData)() Returns whether the form should read and write the data of its parent. | | | bool | [getCompound](#method_getCompound)() Returns whether the form is compound. | | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form types used to construct the form. | | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Returns the view transformers of the form. | | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Returns the model transformers of the form. | | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Returns the data mapper of the form. | | | bool | [getRequired](#method_getRequired)() Returns whether the form is required. | | | bool | [getDisabled](#method_getDisabled)() Returns whether the form is disabled. | | | bool | [getErrorBubbling](#method_getErrorBubbling)() Returns whether errors attached to the form will bubble to its parent. | | | mixed | [getEmptyData](#method_getEmptyData)() Returns the data that should be returned when the form is empty. | | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the form. | | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | | | mixed | [getData](#method_getData)() Returns the initial data of the form. | | | string|null | [getDataClass](#method_getDataClass)() Returns the class of the form data or null if the data is scalar or an array. | | | bool | [getDataLocked](#method_getDataLocked)() Returns whether the form's data is locked. | | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Returns the form factory used for creating new forms. | | | string | [getAction](#method_getAction)() Returns the target URL of the form. | | | string | [getMethod](#method_getMethod)() Returns the HTTP method used by the form. | | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Returns the request handler used by the form. | | | bool | [getAutoInitialize](#method_getAutoInitialize)() Returns whether the form should be initialized upon creation. | | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the form. | | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | | | $this | [setAttribute](#method_setAttribute)(string $name, mixed $value) Sets the value for an attribute. | | | $this | [setAttributes](#method_setAttributes)(array $attributes) Sets the attributes. | | | $this | [setDataMapper](#method_setDataMapper)([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. | | | $this | [setDisabled](#method_setDisabled)(bool $disabled) Set whether the form is disabled. | | | $this | [setEmptyData](#method_setEmptyData)(mixed $emptyData) Sets the data used for the client data when no value is submitted. | | | $this | [setErrorBubbling](#method_setErrorBubbling)(bool $errorBubbling) Sets whether errors bubble up to the parent. | | | $this | [setRequired](#method_setRequired)(bool $required) Sets whether this field is required to be filled out when submitted. | | | $this | [setPropertyPath](#method_setPropertyPath)(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. | | | $this | [setMapped](#method_setMapped)(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. | | | $this | [setByReference](#method_setByReference)(bool $byReference) Sets whether the form's data should be modified by reference. | | | $this | [setInheritData](#method_setInheritData)(bool $inheritData) Sets whether the form should read and write the data of its parent. | | | $this | [setCompound](#method_setCompound)(bool $compound) Sets whether the form should be compound. | | | $this | [setType](#method_setType)([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. | | | $this | [setData](#method_setData)(mixed $data) Sets the initial data of the form. | | | $this | [setDataLocked](#method_setDataLocked)(bool $locked) Locks the form's data to the data passed in the configuration. | | | | [setFormFactory](#method_setFormFactory)([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. | | | $this | [setAction](#method_setAction)(string $action) Sets the target URL of the form. | | | $this | [setMethod](#method_setMethod)(string $method) Sets the HTTP method used by the form. | | | $this | [setRequestHandler](#method_setRequestHandler)([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. | | | $this | [setAutoInitialize](#method_setAutoInitialize)(bool $initialize) Sets whether the form should be initialized automatically. | | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getFormConfig](#method_getFormConfig)() Builds and returns the form configuration. | | | static | [validateName](#method_validateName)(string|int $name) Validates whether the given variable is a valid form name. | | | static bool | [isValidName](#method_isValidName)(string $name) Returns whether the given variable contains a valid form name. | | Details ------- ### \_\_construct(string|int $name, string|null $dataClass, [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") $dispatcher, array $options = array()) Creates an empty form configuration. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The form name | | string|null | $dataClass | The class of the form's data | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | $dispatcher | The event dispatcher | | array | $options | The form options | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the data class is not a valid class or if the name contains invalid characters | ### $this addEventListener(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. #### Parameters | | | | | --- | --- | --- | | string | $eventName | The name of the event to listen to | | callable | $listener | The listener to execute | | int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addEventSubscriber([EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. #### Parameters | | | | | --- | --- | --- | | [EventSubscriberInterface](../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") | $subscriber | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addViewTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. The transform method of the transformer is used to convert data from the normalized to the view format. The reverseTransform method of the transformer is used to convert from the view to the normalized format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $viewTransformer | | | bool | $forcePrepend | If set to true, prepend instead of appending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetViewTransformers() Clears the view transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addModelTransformer([DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. The transform method of the transformer is used to convert data from the model to the normalized format. The reverseTransform method of the transformer is used to convert from the normalized to the model format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $modelTransformer | | | bool | $forceAppend | If set to true, append instead of prepending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetModelTransformers() Clears the normalization transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Returns the event dispatcher used to dispatch form events. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form should be mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Returns whether the form should be mapped to an element of its parent's data. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Returns whether the form's data should be modified by reference. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getInheritData() Returns whether the form should read and write the data of its parent. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### bool getCompound() Returns whether the form is compound. This property is independent of whether the form actually has children. A form can be compound and have no children at all, like for example an empty collection form. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form types used to construct the form. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Returns the view transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Returns the model transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Returns the data mapper of the form. #### Return Value | | | | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Returns whether the form is required. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the form is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Returns whether errors attached to the form will bubble to its parent. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Returns the data that should be returned when the form is empty. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the form. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Returns the initial data of the form. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Returns the class of the form data or null if the data is scalar or an array. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Returns whether the form's data is locked. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Returns the form factory used for creating new forms. #### Return Value | | | | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Returns the target URL of the form. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Returns the HTTP method used by the form. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Returns the request handler used by the form. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Returns whether the form should be initialized upon creation. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### array getOptions() Returns all options passed during the construction of the form. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value | ### $this setAttribute(string $name, mixed $value) Sets the value for an attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the attribute | | mixed | $value | The value of the attribute | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttributes(array $attributes) Sets the attributes. #### Parameters | | | | | --- | --- | --- | | array | $attributes | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataMapper([DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. #### Parameters | | | | | --- | --- | --- | | [DataMapperInterface](datamapperinterface "Symfony\Component\Form\DataMapperInterface") | $dataMapper | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDisabled(bool $disabled) Set whether the form is disabled. #### Parameters | | | | | --- | --- | --- | | bool | $disabled | Whether the form is disabled | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setEmptyData(mixed $emptyData) Sets the data used for the client data when no value is submitted. #### Parameters | | | | | --- | --- | --- | | mixed | $emptyData | The empty data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setErrorBubbling(bool $errorBubbling) Sets whether errors bubble up to the parent. #### Parameters | | | | | --- | --- | --- | | bool | $errorBubbling | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequired(bool $required) Sets whether this field is required to be filled out when submitted. #### Parameters | | | | | --- | --- | --- | | bool | $required | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setPropertyPath(string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. #### Parameters | | | | | --- | --- | --- | | string|[PropertyPathInterface](../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMapped(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. #### Parameters | | | | | --- | --- | --- | | bool | $mapped | Whether the form should be mapped | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setByReference(bool $byReference) Sets whether the form's data should be modified by reference. #### Parameters | | | | | --- | --- | --- | | bool | $byReference | Whether the data should be modified by reference | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setInheritData(bool $inheritData) Sets whether the form should read and write the data of its parent. #### Parameters | | | | | --- | --- | --- | | bool | $inheritData | Whether the form should inherit its parent's data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setCompound(bool $compound) Sets whether the form should be compound. #### Parameters | | | | | --- | --- | --- | | bool | $compound | Whether the form should be compound | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setType([ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setData(mixed $data) Sets the initial data of the form. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The data of the form in application format | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataLocked(bool $locked) Locks the form's data to the data passed in the configuration. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Parameters | | | | | --- | --- | --- | | bool | $locked | Whether to lock the default data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### setFormFactory([FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $formFactory | | ### $this setAction(string $action) Sets the target URL of the form. #### Parameters | | | | | --- | --- | --- | | string | $action | The target URL of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMethod(string $method) Sets the HTTP method used by the form. #### Parameters | | | | | --- | --- | --- | | string | $method | The HTTP method of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequestHandler([RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAutoInitialize(bool $initialize) Sets whether the form should be initialized automatically. Should be set to true only for root forms. #### Parameters | | | | | --- | --- | --- | | bool | $initialize | true to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually | #### Return Value | | | | --- | --- | | $this | The configuration object | ### [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") getFormConfig() Builds and returns the form configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](formconfiginterface "Symfony\Component\Form\FormConfigInterface") | | ### static validateName(string|int $name) Validates whether the given variable is a valid form name. #### Parameters | | | | | --- | --- | --- | | string|int | $name | The tested form name | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the name is not a string or an integer | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the name contains invalid characters | ### static bool isValidName(string $name) Returns whether the given variable contains a valid form name. A name is accepted if it * is empty * starts with a letter, digit or underscore * contains only letters, digits, numbers, underscores ("\_"), hyphens ("-") and colons (":") #### Parameters | | | | | --- | --- | --- | | string | $name | The tested form name | #### Return Value | | | | --- | --- | | bool | Whether the name is valid |
programming_docs
symfony Symfony\Component\Form\Extension\HttpFoundation Symfony\Component\Form\Extension\HttpFoundation =============================================== Namespaces ---------- [Symfony\Component\Form\Extension\HttpFoundation\Type](httpfoundation/type) Classes ------- | | | | --- | --- | | [HttpFoundationExtension](httpfoundation/httpfoundationextension "Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension") | Integrates the HttpFoundation component with the Form library. | | [HttpFoundationRequestHandler](httpfoundation/httpfoundationrequesthandler "Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler") | A request processor using the {@link Request} class of the HttpFoundation component. | symfony Symfony\Component\Form\Extension\DataCollector Symfony\Component\Form\Extension\DataCollector ============================================== Namespaces ---------- [Symfony\Component\Form\Extension\DataCollector\EventListener](datacollector/eventlistener)[Symfony\Component\Form\Extension\DataCollector\Proxy](datacollector/proxy)[Symfony\Component\Form\Extension\DataCollector\Type](datacollector/type) Classes ------- | | | | --- | --- | | [DataCollectorExtension](datacollector/datacollectorextension "Symfony\Component\Form\Extension\DataCollector\DataCollectorExtension") | Extension for collecting data of the forms on a page. | | [FormDataCollector](datacollector/formdatacollector "Symfony\Component\Form\Extension\DataCollector\FormDataCollector") | Data collector for {@link FormInterface} instances. | | [FormDataExtractor](datacollector/formdataextractor "Symfony\Component\Form\Extension\DataCollector\FormDataExtractor") | Default implementation of {@link FormDataExtractorInterface}. | Interfaces ---------- | | | | --- | --- | | *[FormDataCollectorInterface](datacollector/formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface")* | Collects and structures information about forms. | | *[FormDataExtractorInterface](datacollector/formdataextractorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface")* | Extracts arrays of information out of forms. | symfony Symfony\Component\Form\Extension\Validator Symfony\Component\Form\Extension\Validator ========================================== Namespaces ---------- [Symfony\Component\Form\Extension\Validator\Constraints](validator/constraints)[Symfony\Component\Form\Extension\Validator\EventListener](validator/eventlistener)[Symfony\Component\Form\Extension\Validator\Type](validator/type)[Symfony\Component\Form\Extension\Validator\Util](validator/util)[Symfony\Component\Form\Extension\Validator\ViolationMapper](validator/violationmapper) Classes ------- | | | | --- | --- | | [ValidatorExtension](validator/validatorextension "Symfony\Component\Form\Extension\Validator\ValidatorExtension") | Extension supporting the Symfony Validator component in forms. | | [ValidatorTypeGuesser](validator/validatortypeguesser "Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser") | | symfony Symfony\Component\Form\Extension\Core Symfony\Component\Form\Extension\Core ===================================== Namespaces ---------- [Symfony\Component\Form\Extension\Core\DataMapper](core/datamapper)[Symfony\Component\Form\Extension\Core\DataTransformer](core/datatransformer)[Symfony\Component\Form\Extension\Core\EventListener](core/eventlistener)[Symfony\Component\Form\Extension\Core\Type](core/type) Classes ------- | | | | --- | --- | | [CoreExtension](core/coreextension "Symfony\Component\Form\Extension\Core\CoreExtension") | Represents the main form extension, which loads the core functionality. | symfony Symfony\Component\Form\Extension\Templating Symfony\Component\Form\Extension\Templating =========================================== Classes ------- | | | | --- | --- | | [TemplatingExtension](templating/templatingextension "Symfony\Component\Form\Extension\Templating\TemplatingExtension") | Integrates the Templating component with the Form library. | | [TemplatingRendererEngine](templating/templatingrendererengine "Symfony\Component\Form\Extension\Templating\TemplatingRendererEngine") | | symfony Symfony\Component\Form\Extension\DependencyInjection Symfony\Component\Form\Extension\DependencyInjection ==================================================== Classes ------- | | | | --- | --- | | [DependencyInjectionExtension](dependencyinjection/dependencyinjectionextension "Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension") | | symfony Symfony\Component\Form\Extension\Csrf Symfony\Component\Form\Extension\Csrf ===================================== Namespaces ---------- [Symfony\Component\Form\Extension\Csrf\EventListener](csrf/eventlistener)[Symfony\Component\Form\Extension\Csrf\Type](csrf/type) Classes ------- | | | | --- | --- | | [CsrfExtension](csrf/csrfextension "Symfony\Component\Form\Extension\Csrf\CsrfExtension") | This extension protects forms by using a CSRF token. | symfony DataCollectorExtension DataCollectorExtension ======================= class **DataCollectorExtension** extends [AbstractExtension](../../abstractextension "Symfony\Component\Form\AbstractExtension") Extension for collecting data of the forms on a page. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | from [AbstractExtension](../../abstractextension#method_getType "Symfony\Component\Form\AbstractExtension") | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | from [AbstractExtension](../../abstractextension#method_hasType "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | from [AbstractExtension](../../abstractextension#method_getTypeExtensions "Symfony\Component\Form\AbstractExtension") | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | from [AbstractExtension](../../abstractextension#method_hasTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | from [AbstractExtension](../../abstractextension#method_getTypeGuesser "Symfony\Component\Form\AbstractExtension") | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | from [AbstractExtension](../../abstractextension#method_loadTypes "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | from [AbstractExtension](../../abstractextension#method_loadTypeGuesser "Symfony\Component\Form\AbstractExtension") | | | [\_\_construct](#method___construct)([FormDataCollectorInterface](formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) | | Details ------- ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### protected [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | ### \_\_construct([FormDataCollectorInterface](formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) #### Parameters | | | | | --- | --- | --- | | [FormDataCollectorInterface](formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") | $dataCollector | | symfony FormDataCollectorInterface FormDataCollectorInterface =========================== interface **FormDataCollectorInterface** implements [DataCollectorInterface](../../../httpkernel/datacollector/datacollectorinterface "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface") Collects and structures information about forms. Methods ------- | | | | | --- | --- | --- | | | [collect](#method_collect)([Request](../../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. | from [DataCollectorInterface](../../../httpkernel/datacollector/datacollectorinterface#method_collect "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface") | | string | [getName](#method_getName)() Returns the name of the collector. | from [DataCollectorInterface](../../../httpkernel/datacollector/datacollectorinterface#method_getName "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface") | | | [reset](#method_reset)() Resets this data collector to its initial state. | from [DataCollectorInterface](../../../httpkernel/datacollector/datacollectorinterface#method_reset "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface") | | | [collectConfiguration](#method_collectConfiguration)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores configuration data of the given form and its children. | | | | [collectDefaultData](#method_collectDefaultData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the default data of the given form and its children. | | | | [collectSubmittedData](#method_collectSubmittedData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the submitted data of the given form and its children. | | | | [collectViewVariables](#method_collectViewVariables)([FormView](../../formview "Symfony\Component\Form\FormView") $view) Stores the view variables of the given form view and its children. | | | | [associateFormWithView](#method_associateFormWithView)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Specifies that the given objects represent the same conceptual form. | | | | [buildPreliminaryFormTree](#method_buildPreliminaryFormTree)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Assembles the data collected about the given form and its children as a tree-like data structure. | | | | [buildFinalFormTree](#method_buildFinalFormTree)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Assembles the data collected about the given form and its children as a tree-like data structure. | | | array | [getData](#method_getData)() Returns all collected data. | | Details ------- ### collect([Request](../../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. #### Parameters | | | | | --- | --- | --- | | [Request](../../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | | | [Response](../../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | | | [Exception](http://php.net/Exception) | $exception | | ### string getName() Returns the name of the collector. #### Return Value | | | | --- | --- | | string | The collector name | ### reset() Resets this data collector to its initial state. ### collectConfiguration([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores configuration data of the given form and its children. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### collectDefaultData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the default data of the given form and its children. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### collectSubmittedData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the submitted data of the given form and its children. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### collectViewVariables([FormView](../../formview "Symfony\Component\Form\FormView") $view) Stores the view variables of the given form view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | ### associateFormWithView([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Specifies that the given objects represent the same conceptual form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | ### buildPreliminaryFormTree([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Assembles the data collected about the given form and its children as a tree-like data structure. The result can be queried using {@link getData()}. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### buildFinalFormTree([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Assembles the data collected about the given form and its children as a tree-like data structure. The result can be queried using {@link getData()}. Contrary to {@link buildPreliminaryFormTree()}, a {@link FormView} object has to be passed. The tree structure of this view object will be used for structuring the resulting data. That means, if a child is present in the view, but not in the form, it will be present in the final data array anyway. When {@link FormView} instances are present in the view tree, for which no corresponding {@link FormInterface} objects can be found in the form tree, only the view data will be included in the result. If a corresponding {@link FormInterface} exists otherwise, call {@link associateFormWithView()} before calling this method. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | ### array getData() Returns all collected data. #### Return Value | | | | --- | --- | | array | | symfony Symfony\Component\Form\Extension\DataCollector\Type Symfony\Component\Form\Extension\DataCollector\Type =================================================== Classes ------- | | | | --- | --- | | [DataCollectorTypeExtension](type/datacollectortypeextension "Symfony\Component\Form\Extension\DataCollector\Type\DataCollectorTypeExtension") | Type extension for collecting data of a form with this type. | symfony FormDataExtractor FormDataExtractor ================== class **FormDataExtractor** implements [FormDataExtractorInterface](formdataextractorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface") Default implementation of {@link FormDataExtractorInterface}. Methods ------- | | | | | --- | --- | --- | | array | [extractConfiguration](#method_extractConfiguration)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the configuration data of a form. | | | array | [extractDefaultData](#method_extractDefaultData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the default data of a form. | | | array | [extractSubmittedData](#method_extractSubmittedData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the submitted data of a form. | | | array | [extractViewVariables](#method_extractViewVariables)([FormView](../../formview "Symfony\Component\Form\FormView") $view) Extracts the view variables of a form. | | Details ------- ### array extractConfiguration([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the configuration data of a form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | #### Return Value | | | | --- | --- | | array | Information about the form's configuration | ### array extractDefaultData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the default data of a form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | #### Return Value | | | | --- | --- | | array | Information about the form's default data | ### array extractSubmittedData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the submitted data of a form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | #### Return Value | | | | --- | --- | | array | Information about the form's submitted data | ### array extractViewVariables([FormView](../../formview "Symfony\Component\Form\FormView") $view) Extracts the view variables of a form. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | #### Return Value | | | | --- | --- | | array | Information about the view's variables |
programming_docs
symfony FormDataExtractorInterface FormDataExtractorInterface =========================== interface **FormDataExtractorInterface** Extracts arrays of information out of forms. Methods ------- | | | | | --- | --- | --- | | array | [extractConfiguration](#method_extractConfiguration)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the configuration data of a form. | | | array | [extractDefaultData](#method_extractDefaultData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the default data of a form. | | | array | [extractSubmittedData](#method_extractSubmittedData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the submitted data of a form. | | | array | [extractViewVariables](#method_extractViewVariables)([FormView](../../formview "Symfony\Component\Form\FormView") $view) Extracts the view variables of a form. | | Details ------- ### array extractConfiguration([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the configuration data of a form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | #### Return Value | | | | --- | --- | | array | Information about the form's configuration | ### array extractDefaultData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the default data of a form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | #### Return Value | | | | --- | --- | | array | Information about the form's default data | ### array extractSubmittedData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Extracts the submitted data of a form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | #### Return Value | | | | --- | --- | | array | Information about the form's submitted data | ### array extractViewVariables([FormView](../../formview "Symfony\Component\Form\FormView") $view) Extracts the view variables of a form. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | #### Return Value | | | | --- | --- | | array | Information about the view's variables | symfony FormDataCollector FormDataCollector ================== class **FormDataCollector** extends [DataCollector](../../../httpkernel/datacollector/datacollector "Symfony\Component\HttpKernel\DataCollector\DataCollector") implements [FormDataCollectorInterface](formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") Data collector for {@link FormInterface} instances. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $data | | from [DataCollector](../../../httpkernel/datacollector/datacollector#property_data "Symfony\Component\HttpKernel\DataCollector\DataCollector") | Methods ------- | | | | | --- | --- | --- | | | [serialize](#method_serialize)() | | | | [unserialize](#method_unserialize)($data) | from [DataCollector](../../../httpkernel/datacollector/datacollector#method_unserialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | [Data](../../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | [cloneVar](#method_cloneVar)(mixed $var) Converts the variable into a serializable Data instance. | from [DataCollector](../../../httpkernel/datacollector/datacollector#method_cloneVar "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | callable[] | [getCasters](#method_getCasters)() | | | | [\_\_construct](#method___construct)([FormDataExtractorInterface](formdataextractorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface") $dataExtractor) | | | | [collect](#method_collect)([Request](../../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Does nothing. The data is collected during the form event listeners. | | | | [reset](#method_reset)() Resets this data collector to its initial state. | | | | [associateFormWithView](#method_associateFormWithView)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Specifies that the given objects represent the same conceptual form. | | | | [collectConfiguration](#method_collectConfiguration)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores configuration data of the given form and its children. | | | | [collectDefaultData](#method_collectDefaultData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the default data of the given form and its children. | | | | [collectSubmittedData](#method_collectSubmittedData)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the submitted data of the given form and its children. | | | | [collectViewVariables](#method_collectViewVariables)([FormView](../../formview "Symfony\Component\Form\FormView") $view) Stores the view variables of the given form view and its children. | | | | [buildPreliminaryFormTree](#method_buildPreliminaryFormTree)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Assembles the data collected about the given form and its children as a tree-like data structure. | | | | [buildFinalFormTree](#method_buildFinalFormTree)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Assembles the data collected about the given form and its children as a tree-like data structure. | | | string | [getName](#method_getName)() Returns the name of the collector. | | | array | [getData](#method_getData)() Returns all collected data. | | Details ------- ### serialize() ### unserialize($data) #### Parameters | | | | | --- | --- | --- | | | $data | | ### protected [Data](../../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") cloneVar(mixed $var) Converts the variable into a serializable Data instance. This array can be displayed in the template using the VarDumper component. #### Parameters | | | | | --- | --- | --- | | mixed | $var | | #### Return Value | | | | --- | --- | | [Data](../../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | | ### protected callable[] getCasters() #### Return Value | | | | --- | --- | | callable[] | The casters to add to the cloner | ### \_\_construct([FormDataExtractorInterface](formdataextractorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface") $dataExtractor) #### Parameters | | | | | --- | --- | --- | | [FormDataExtractorInterface](formdataextractorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataExtractorInterface") | $dataExtractor | | ### collect([Request](../../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Does nothing. The data is collected during the form event listeners. #### Parameters | | | | | --- | --- | --- | | [Request](../../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | | | [Response](../../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | | | [Exception](http://php.net/Exception) | $exception | | ### reset() Resets this data collector to its initial state. ### associateFormWithView([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Specifies that the given objects represent the same conceptual form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | ### collectConfiguration([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores configuration data of the given form and its children. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### collectDefaultData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the default data of the given form and its children. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### collectSubmittedData([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Stores the submitted data of the given form and its children. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### collectViewVariables([FormView](../../formview "Symfony\Component\Form\FormView") $view) Stores the view variables of the given form view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | ### buildPreliminaryFormTree([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form) Assembles the data collected about the given form and its children as a tree-like data structure. The result can be queried using {@link getData()}. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | ### buildFinalFormTree([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../formview "Symfony\Component\Form\FormView") $view) Assembles the data collected about the given form and its children as a tree-like data structure. The result can be queried using {@link getData()}. Contrary to {@link buildPreliminaryFormTree()}, a {@link FormView} object has to be passed. The tree structure of this view object will be used for structuring the resulting data. That means, if a child is present in the view, but not in the form, it will be present in the final data array anyway. When {@link FormView} instances are present in the view tree, for which no corresponding {@link FormInterface} objects can be found in the form tree, only the view data will be included in the result. If a corresponding {@link FormInterface} exists otherwise, call {@link associateFormWithView()} before calling this method. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | | ### string getName() Returns the name of the collector. #### Return Value | | | | --- | --- | | string | The collector name | ### array getData() Returns all collected data. #### Return Value | | | | --- | --- | | array | | symfony Symfony\Component\Form\Extension\DataCollector\Proxy Symfony\Component\Form\Extension\DataCollector\Proxy ==================================================== Classes ------- | | | | --- | --- | | [ResolvedTypeDataCollectorProxy](proxy/resolvedtypedatacollectorproxy "Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy") | Proxy that invokes a data collector when creating a form and its view. | | [ResolvedTypeFactoryDataCollectorProxy](proxy/resolvedtypefactorydatacollectorproxy "Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeFactoryDataCollectorProxy") | Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy} instances. | symfony Symfony\Component\Form\Extension\DataCollector\EventListener Symfony\Component\Form\Extension\DataCollector\EventListener ============================================================ Classes ------- | | | | --- | --- | | [DataCollectorListener](eventlistener/datacollectorlistener "Symfony\Component\Form\Extension\DataCollector\EventListener\DataCollectorListener") | Listener that invokes a data collector for the {@link FormEvents::POST\_SET\_DATA} and {@link FormEvents::POST\_SUBMIT} events. | symfony ResolvedTypeFactoryDataCollectorProxy ResolvedTypeFactoryDataCollectorProxy ====================================== class **ResolvedTypeFactoryDataCollectorProxy** implements [ResolvedFormTypeFactoryInterface](../../../resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") Proxy that wraps resolved types into {@link ResolvedTypeDataCollectorProxy} instances. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ResolvedFormTypeFactoryInterface](../../../resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $proxiedFactory, [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) | | | [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [createResolvedType](#method_createResolvedType)([FormTypeInterface](../../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type, array $typeExtensions, [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) Resolves a form type. | | Details ------- ### \_\_construct([ResolvedFormTypeFactoryInterface](../../../resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") $proxiedFactory, [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeFactoryInterface](../../../resolvedformtypefactoryinterface "Symfony\Component\Form\ResolvedFormTypeFactoryInterface") | $proxiedFactory | | | [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") | $dataCollector | | ### [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") createResolvedType([FormTypeInterface](../../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") $type, array $typeExtensions, [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $parent = null) Resolves a form type. #### Parameters | | | | | --- | --- | --- | | [FormTypeInterface](../../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | $type | | | array | $typeExtensions | | | [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $parent | | #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the types parent {@link FormTypeInterface::getParent()} is not a string | | [InvalidArgumentException](../../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the types parent can not be retrieved from any extension | symfony ResolvedTypeDataCollectorProxy ResolvedTypeDataCollectorProxy =============================== class **ResolvedTypeDataCollectorProxy** implements [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") Proxy that invokes a data collector when creating a form and its view. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $proxiedType, [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface")|null | [getParent](#method_getParent)() Returns the parent type. | | | [FormTypeInterface](../../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getInnerType](#method_getInnerType)() Returns the wrapped form type. | | | [FormTypeExtensionInterface](../../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)() Returns the extensions of the wrapped form type. | | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [createBuilder](#method_createBuilder)([FormFactoryInterface](../../../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, string $name, array $options = array()) Creates a new form builder for this type. | | | [FormView](../../../formview "Symfony\Component\Form\FormView") | [createView](#method_createView)([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../../formview "Symfony\Component\Form\FormView") $parent = null) Creates a new form view for a form of this type. | | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Configures a form builder for the type hierarchy. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Configures a form view for the type hierarchy. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes a form view for the type hierarchy. | | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | [getOptionsResolver](#method_getOptionsResolver)() Returns the configured options resolver used for this type. | | Details ------- ### \_\_construct([ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $proxiedType, [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $proxiedType | | | [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") | $dataCollector | | ### string getBlockPrefix() Returns the prefix of the template block name for this type. #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface")|null getParent() Returns the parent type. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](../../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface")|null | The parent type or null | ### [FormTypeInterface](../../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getInnerType() Returns the wrapped form type. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The wrapped form type | ### [FormTypeExtensionInterface](../../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions() Returns the extensions of the wrapped form type. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of {@link FormTypeExtensionInterface} instances | ### [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") createBuilder([FormFactoryInterface](../../../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $factory, string $name, array $options = array()) Creates a new form builder for this type. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](../../../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | The form factory | | string | $name | The name for the builder | | array | $options | The builder options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | The created form builder | ### [FormView](../../../formview "Symfony\Component\Form\FormView") createView([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, [FormView](../../../formview "Symfony\Component\Form\FormView") $parent = null) Creates a new form view for a form of this type. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form to create a view for | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $parent | The parent view or null | #### Return Value | | | | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | The created form view | ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Configures a form builder for the type hierarchy. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The builder to configure | | array | $options | The options used for the configuration | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Configures a form view for the type hierarchy. It is called before the children of the view are built. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The form view to configure | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form corresponding to the view | | array | $options | The options used for the configuration | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes a form view for the type hierarchy. It is called after the children of the view have been built. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The form view to configure | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form corresponding to the view | | array | $options | The options used for the configuration | ### [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") getOptionsResolver() Returns the configured options resolver used for this type. #### Return Value | | | | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | The options resolver |
programming_docs
symfony DataCollectorTypeExtension DataCollectorTypeExtension =========================== class **DataCollectorTypeExtension** extends [AbstractTypeExtension](../../../abstracttypeextension "Symfony\Component\Form\AbstractTypeExtension") Type extension for collecting data of a form with this type. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractTypeExtension](../../../abstracttypeextension#method_configureOptions "Symfony\Component\Form\AbstractTypeExtension") | | | [\_\_construct](#method___construct)([FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### \_\_construct([FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) #### Parameters | | | | | --- | --- | --- | | [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") | $dataCollector | | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended | symfony DataCollectorListener DataCollectorListener ====================== class **DataCollectorListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Listener that invokes a data collector for the {@link FormEvents::POST\_SET\_DATA} and {@link FormEvents::POST\_SUBMIT} events. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) | | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | | | [postSetData](#method_postSetData)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) Listener for the {@link FormEvents::POST\_SET\_DATA} event. | | | | [postSubmit](#method_postSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) Listener for the {@link FormEvents::POST\_SUBMIT} event. | | Details ------- ### \_\_construct([FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") $dataCollector) #### Parameters | | | | | --- | --- | --- | | [FormDataCollectorInterface](../formdatacollectorinterface "Symfony\Component\Form\Extension\DataCollector\FormDataCollectorInterface") | $dataCollector | | ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | ### postSetData([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) Listener for the {@link FormEvents::POST\_SET\_DATA} event. #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | ### postSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) Listener for the {@link FormEvents::POST\_SUBMIT} event. #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | symfony Symfony\Component\Form\Extension\Core\DataMapper Symfony\Component\Form\Extension\Core\DataMapper ================================================ Classes ------- | | | | --- | --- | | [CheckboxListMapper](datamapper/checkboxlistmapper "Symfony\Component\Form\Extension\Core\DataMapper\CheckboxListMapper") | Maps choices to/from checkbox forms. | | [PropertyPathMapper](datamapper/propertypathmapper "Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper") | Maps arrays/objects to/from forms using property paths. | | [RadioListMapper](datamapper/radiolistmapper "Symfony\Component\Form\Extension\Core\DataMapper\RadioListMapper") | Maps choices to/from radio forms. | symfony Symfony\Component\Form\Extension\Core\Type Symfony\Component\Form\Extension\Core\Type ========================================== Classes ------- | | | | --- | --- | | [BaseType](type/basetype "Symfony\Component\Form\Extension\Core\Type\BaseType") | Encapsulates common logic of {@link FormType} and {@link ButtonType}. | | [BirthdayType](type/birthdaytype "Symfony\Component\Form\Extension\Core\Type\BirthdayType") | | | [ButtonType](type/buttontype "Symfony\Component\Form\Extension\Core\Type\ButtonType") | A form button. | | [CheckboxType](type/checkboxtype "Symfony\Component\Form\Extension\Core\Type\CheckboxType") | | | [ChoiceType](type/choicetype "Symfony\Component\Form\Extension\Core\Type\ChoiceType") | | | [CollectionType](type/collectiontype "Symfony\Component\Form\Extension\Core\Type\CollectionType") | | | [ColorType](type/colortype "Symfony\Component\Form\Extension\Core\Type\ColorType") | | | [CountryType](type/countrytype "Symfony\Component\Form\Extension\Core\Type\CountryType") | | | [CurrencyType](type/currencytype "Symfony\Component\Form\Extension\Core\Type\CurrencyType") | | | [DateIntervalType](type/dateintervaltype "Symfony\Component\Form\Extension\Core\Type\DateIntervalType") | | | [DateTimeType](type/datetimetype "Symfony\Component\Form\Extension\Core\Type\DateTimeType") | | | [DateType](type/datetype "Symfony\Component\Form\Extension\Core\Type\DateType") | | | [EmailType](type/emailtype "Symfony\Component\Form\Extension\Core\Type\EmailType") | | | [FileType](type/filetype "Symfony\Component\Form\Extension\Core\Type\FileType") | | | [FormType](type/formtype "Symfony\Component\Form\Extension\Core\Type\FormType") | | | [HiddenType](type/hiddentype "Symfony\Component\Form\Extension\Core\Type\HiddenType") | | | [IntegerType](type/integertype "Symfony\Component\Form\Extension\Core\Type\IntegerType") | | | [LanguageType](type/languagetype "Symfony\Component\Form\Extension\Core\Type\LanguageType") | | | [LocaleType](type/localetype "Symfony\Component\Form\Extension\Core\Type\LocaleType") | | | [MoneyType](type/moneytype "Symfony\Component\Form\Extension\Core\Type\MoneyType") | | | [NumberType](type/numbertype "Symfony\Component\Form\Extension\Core\Type\NumberType") | | | [PasswordType](type/passwordtype "Symfony\Component\Form\Extension\Core\Type\PasswordType") | | | [PercentType](type/percenttype "Symfony\Component\Form\Extension\Core\Type\PercentType") | | | [RadioType](type/radiotype "Symfony\Component\Form\Extension\Core\Type\RadioType") | | | [RangeType](type/rangetype "Symfony\Component\Form\Extension\Core\Type\RangeType") | | | [RepeatedType](type/repeatedtype "Symfony\Component\Form\Extension\Core\Type\RepeatedType") | | | [ResetType](type/resettype "Symfony\Component\Form\Extension\Core\Type\ResetType") | A reset button. | | [SearchType](type/searchtype "Symfony\Component\Form\Extension\Core\Type\SearchType") | | | [SubmitType](type/submittype "Symfony\Component\Form\Extension\Core\Type\SubmitType") | A submit button. | | [TelType](type/teltype "Symfony\Component\Form\Extension\Core\Type\TelType") | | | [TextType](type/texttype "Symfony\Component\Form\Extension\Core\Type\TextType") | | | [TextareaType](type/textareatype "Symfony\Component\Form\Extension\Core\Type\TextareaType") | | | [TimeType](type/timetype "Symfony\Component\Form\Extension\Core\Type\TimeType") | | | [TimezoneType](type/timezonetype "Symfony\Component\Form\Extension\Core\Type\TimezoneType") | | | [UrlType](type/urltype "Symfony\Component\Form\Extension\Core\Type\UrlType") | | symfony Symfony\Component\Form\Extension\Core\DataTransformer Symfony\Component\Form\Extension\Core\DataTransformer ===================================================== Classes ------- | | | | --- | --- | | [ArrayToPartsTransformer](datatransformer/arraytopartstransformer "Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer") | | | [BaseDateTimeTransformer](datatransformer/basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | | [BooleanToStringTransformer](datatransformer/booleantostringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer") | Transforms between a Boolean and a string. | | [ChoiceToValueTransformer](datatransformer/choicetovaluetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer") | | | [ChoicesToValuesTransformer](datatransformer/choicestovaluestransformer "Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer") | | | [DataTransformerChain](datatransformer/datatransformerchain "Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain") | Passes a value through multiple value transformers. | | [DateIntervalToArrayTransformer](datatransformer/dateintervaltoarraytransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToArrayTransformer") | Transforms between a normalized date interval and an interval string/array. | | [DateIntervalToStringTransformer](datatransformer/dateintervaltostringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToStringTransformer") | Transforms between a date string and a DateInterval object. | | [DateTimeImmutableToDateTimeTransformer](datatransformer/datetimeimmutabletodatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer") | Transforms between a DateTimeImmutable object and a DateTime object. | | [DateTimeToArrayTransformer](datatransformer/datetimetoarraytransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer") | Transforms between a normalized time and a localized time string/array. | | [DateTimeToHtml5LocalDateTimeTransformer](datatransformer/datetimetohtml5localdatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToHtml5LocalDateTimeTransformer") | | | [DateTimeToLocalizedStringTransformer](datatransformer/datetimetolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer") | Transforms between a normalized time and a localized time string. | | [DateTimeToRfc3339Transformer](datatransformer/datetimetorfc3339transformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer") | | | [DateTimeToStringTransformer](datatransformer/datetimetostringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer") | Transforms between a date string and a DateTime object. | | [DateTimeToTimestampTransformer](datatransformer/datetimetotimestamptransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer") | Transforms between a timestamp and a DateTime object. | | [DateTimeZoneToStringTransformer](datatransformer/datetimezonetostringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeZoneToStringTransformer") | Transforms between a timezone identifier string and a DateTimeZone object. | | [IntegerToLocalizedStringTransformer](datatransformer/integertolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer") | Transforms between an integer and a localized number with grouping (each thousand) and comma separators. | | [MoneyToLocalizedStringTransformer](datatransformer/moneytolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer") | Transforms between a normalized format and a localized money string. | | [NumberToLocalizedStringTransformer](datatransformer/numbertolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | Transforms between a number type and a localized number with grouping (each thousand) and comma separators. | | [PercentToLocalizedStringTransformer](datatransformer/percenttolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer") | Transforms between a normalized format (integer or float) and a percentage value. | | [ValueToDuplicatesTransformer](datatransformer/valuetoduplicatestransformer "Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer") | | symfony CoreExtension CoreExtension ============== class **CoreExtension** extends [AbstractExtension](../../abstractextension "Symfony\Component\Form\AbstractExtension") Represents the main form extension, which loads the core functionality. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | from [AbstractExtension](../../abstractextension#method_getType "Symfony\Component\Form\AbstractExtension") | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | from [AbstractExtension](../../abstractextension#method_hasType "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | from [AbstractExtension](../../abstractextension#method_getTypeExtensions "Symfony\Component\Form\AbstractExtension") | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | from [AbstractExtension](../../abstractextension#method_hasTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | from [AbstractExtension](../../abstractextension#method_getTypeGuesser "Symfony\Component\Form\AbstractExtension") | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | from [AbstractExtension](../../abstractextension#method_loadTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | from [AbstractExtension](../../abstractextension#method_loadTypeGuesser "Symfony\Component\Form\AbstractExtension") | | | [\_\_construct](#method___construct)([PropertyAccessorInterface](../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null, [ChoiceListFactoryInterface](../../choicelist/factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $choiceListFactory = null) | | Details ------- ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### protected [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | ### \_\_construct([PropertyAccessorInterface](../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null, [ChoiceListFactoryInterface](../../choicelist/factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $choiceListFactory = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessorInterface](../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") | $propertyAccessor | | | [ChoiceListFactoryInterface](../../choicelist/factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | $choiceListFactory | |
programming_docs
symfony Symfony\Component\Form\Extension\Core\EventListener Symfony\Component\Form\Extension\Core\EventListener =================================================== Classes ------- | | | | --- | --- | | [FixUrlProtocolListener](eventlistener/fixurlprotocollistener "Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener") | Adds a protocol to a URL if it doesn't already have one. | | [MergeCollectionListener](eventlistener/mergecollectionlistener "Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener") | | | [ResizeFormListener](eventlistener/resizeformlistener "Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener") | Resize a collection form element based on the data sent from the client. | | [TrimListener](eventlistener/trimlistener "Symfony\Component\Form\Extension\Core\EventListener\TrimListener") | Trims string data. | symfony RadioListMapper RadioListMapper ================ class **RadioListMapper** implements [DataMapperInterface](../../../datamapperinterface "Symfony\Component\Form\DataMapperInterface") Maps choices to/from radio forms. A {@link ChoiceListInterface} implementation is used to find the corresponding string values for the choices. The radio form whose "value" option corresponds to the selected value is marked as selected. Methods ------- | | | | | --- | --- | --- | | | [mapDataToForms](#method_mapDataToForms)($choice, $radios) Maps properties of some data to a list of forms. | | | | [mapFormsToData](#method_mapFormsToData)($radios, $choice) Maps the data of a list of forms into the properties of some data. | | Details ------- ### mapDataToForms($choice, $radios) Maps properties of some data to a list of forms. #### Parameters | | | | | --- | --- | --- | | | $choice | | | | $radios | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | ### mapFormsToData($radios, $choice) Maps the data of a list of forms into the properties of some data. #### Parameters | | | | | --- | --- | --- | | | $radios | | | | $choice | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | symfony PropertyPathMapper PropertyPathMapper =================== class **PropertyPathMapper** implements [DataMapperInterface](../../../datamapperinterface "Symfony\Component\Form\DataMapperInterface") Maps arrays/objects to/from forms using property paths. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([PropertyAccessorInterface](../../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null) | | | | [mapDataToForms](#method_mapDataToForms)(mixed $data, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms) Maps properties of some data to a list of forms. | | | | [mapFormsToData](#method_mapFormsToData)([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms, mixed $data) Maps the data of a list of forms into the properties of some data. | | Details ------- ### \_\_construct([PropertyAccessorInterface](../../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessorInterface](../../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") | $propertyAccessor | | ### mapDataToForms(mixed $data, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms) Maps properties of some data to a list of forms. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Structured data | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) | $forms | A list of {@link FormInterface} instances | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | ### mapFormsToData([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) $forms, mixed $data) Maps the data of a list of forms into the properties of some data. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")[]|[Traversable](http://php.net/Traversable) | $forms | A list of {@link FormInterface} instances | | mixed | $data | Structured data | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | symfony CheckboxListMapper CheckboxListMapper =================== class **CheckboxListMapper** implements [DataMapperInterface](../../../datamapperinterface "Symfony\Component\Form\DataMapperInterface") Maps choices to/from checkbox forms. A {@link ChoiceListInterface} implementation is used to find the corresponding string values for the choices. Each checkbox form whose "value" option corresponds to any of the selected values is marked as selected. Methods ------- | | | | | --- | --- | --- | | | [mapDataToForms](#method_mapDataToForms)($choices, $checkboxes) Maps properties of some data to a list of forms. | | | | [mapFormsToData](#method_mapFormsToData)($checkboxes, $choices) Maps the data of a list of forms into the properties of some data. | | Details ------- ### mapDataToForms($choices, $checkboxes) Maps properties of some data to a list of forms. #### Parameters | | | | | --- | --- | --- | | | $choices | | | | $checkboxes | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | ### mapFormsToData($checkboxes, $choices) Maps the data of a list of forms into the properties of some data. #### Parameters | | | | | --- | --- | --- | | | $checkboxes | | | | $choices | | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the type of the data parameter is not supported | symfony DataTransformerChain DataTransformerChain ===================== class **DataTransformerChain** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Passes a value through multiple value transformers. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $transformers | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $transformers) Uses the given value transformers to transform values. | | | mixed | [transform](#method_transform)(mixed $value) Passes the value through the transform() method of all nested transformers. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Passes the value through the reverseTransform() method of all nested transformers. | | | [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getTransformers](#method_getTransformers)() | | Details ------- ### \_\_construct(array $transformers) Uses the given value transformers to transform values. #### Parameters | | | | | --- | --- | --- | | array | $transformers | | ### mixed transform(mixed $value) Passes the value through the transform() method of all nested transformers. The transformers receive the value in the same order as they were passed to the constructor. Each transformer receives the result of the previous transformer as input. The output of the last transformer is returned by this method. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | | ### mixed reverseTransform(mixed $value) Passes the value through the reverseTransform() method of all nested transformers. The transformers receive the value in the reverse order as they were passed to the constructor. Each transformer receives the result of the previous transformer as input. The output of the last transformer is returned by this method. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | | ### [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getTransformers() #### Return Value | | | | --- | --- | | [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | | symfony DateIntervalToStringTransformer DateIntervalToStringTransformer ================================ class **DateIntervalToStringTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a date string and a DateInterval object. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $format = 'P%yY%mM%dDT%hH%iM%sS') Transforms a \DateInterval instance to a string. | | | mixed | [transform](#method_transform)(mixed $value) Transforms a DateInterval object into a date string with the configured format. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a date string in the configured format into a DateInterval object. | | Details ------- ### \_\_construct(string $format = 'P%yY%mM%dDT%hH%iM%sS') Transforms a \DateInterval instance to a string. #### Parameters | | | | | --- | --- | --- | | string | $format | The date format | #### See also | | | | --- | --- | | \DateInterval::format() | for supported formats | ### mixed transform(mixed $value) Transforms a DateInterval object into a date string with the configured format. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the given value is not a \DateInterval instance | ### mixed reverseTransform(mixed $value) Transforms a date string in the configured format into a DateInterval object. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the given value is not a string | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the date interval could not be parsed | symfony ChoicesToValuesTransformer ChoicesToValuesTransformer =========================== class **ChoicesToValuesTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $choiceList) | | | mixed | [transform](#method_transform)($array) | | | mixed | [reverseTransform](#method_reverseTransform)($array) | | Details ------- ### \_\_construct([ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $choiceList) #### Parameters | | | | | --- | --- | --- | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | $choiceList | | ### mixed transform($array) #### Parameters | | | | | --- | --- | --- | | | $array | | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not an array | ### mixed reverseTransform($array) #### Parameters | | | | | --- | --- | --- | | | $array | | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not an array or if no matching choice could be found for some given value | symfony DateTimeToLocalizedStringTransformer DateTimeToLocalizedStringTransformer ===================================== class **DateTimeToLocalizedStringTransformer** extends [BaseDateTimeTransformer](basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") Transforms between a normalized time and a localized time string. Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | from [BaseDateTimeTransformer](basedatetimetransformer#property_formats "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $inputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_inputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $outputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_outputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null, int $dateFormat = null, int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, string $pattern = null) | | | mixed | [transform](#method_transform)([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a normalized date into a localized date string/array. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a localized date string/array into a normalized date. | | | [IntlDateFormatter](http://php.net/IntlDateFormatter) | [getIntlDateFormatter](#method_getIntlDateFormatter)(bool $ignoreTimezone = false) Returns a preconfigured IntlDateFormatter instance. | | | bool | [isPatternDateOnly](#method_isPatternDateOnly)() Checks if the pattern contains only a date. | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null, int $dateFormat = null, int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, string $pattern = null) #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | | int | $dateFormat | The date format | | int | $timeFormat | The time format | | int | $calendar | One of the \IntlDateFormatter calendar constants | | string | $pattern | A pattern to pass to \IntlDateFormatter | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | If a format is not supported or if a timezone is not a string | #### See also | | | | --- | --- | | BaseDateTimeTransformer::formats | for available format options | ### mixed transform([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a normalized date into a localized date string/array. #### Parameters | | | | | --- | --- | --- | | [DateTimeInterface](http://php.net/DateTimeInterface) | $dateTime | A DateTimeInterface object | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a \DateTimeInterface or if the date could not be transformed | ### mixed reverseTransform(mixed $value) Transforms a localized date string/array into a normalized date. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a string, if the date could not be parsed | ### protected [IntlDateFormatter](http://php.net/IntlDateFormatter) getIntlDateFormatter(bool $ignoreTimezone = false) Returns a preconfigured IntlDateFormatter instance. #### Parameters | | | | | --- | --- | --- | | bool | $ignoreTimezone | Use UTC regardless of the configured timezone | #### Return Value | | | | --- | --- | | [IntlDateFormatter](http://php.net/IntlDateFormatter) | | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | in case the date formatter can not be constructed | ### protected bool isPatternDateOnly() Checks if the pattern contains only a date. #### Return Value | | | | --- | --- | | bool | | symfony DateTimeToTimestampTransformer DateTimeToTimestampTransformer =============================== class **DateTimeToTimestampTransformer** extends [BaseDateTimeTransformer](basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") Transforms between a timestamp and a DateTime object. Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | from [BaseDateTimeTransformer](basedatetimetransformer#property_formats "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $inputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_inputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $outputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_outputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null) | from [BaseDateTimeTransformer](basedatetimetransformer#method___construct "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | mixed | [transform](#method_transform)([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a DateTime object into a timestamp in the configured timezone. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a timestamp in the configured timezone into a DateTime object. | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null) #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if a timezone is not valid | ### mixed transform([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a DateTime object into a timestamp in the configured timezone. #### Parameters | | | | | --- | --- | --- | | [DateTimeInterface](http://php.net/DateTimeInterface) | $dateTime | A DateTimeInterface object | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a \DateTimeInterface | ### mixed reverseTransform(mixed $value) Transforms a timestamp in the configured timezone into a DateTime object. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a timestamp or if the given timestamp is invalid |
programming_docs
symfony DateTimeToRfc3339Transformer DateTimeToRfc3339Transformer ============================= class **DateTimeToRfc3339Transformer** extends [BaseDateTimeTransformer](basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | from [BaseDateTimeTransformer](basedatetimetransformer#property_formats "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $inputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_inputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $outputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_outputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null) | from [BaseDateTimeTransformer](basedatetimetransformer#method___construct "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | mixed | [transform](#method_transform)([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a normalized date into a localized date. | | | mixed | [reverseTransform](#method_reverseTransform)(string $rfc3339) Transforms a formatted string following RFC 3339 into a normalized date. | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null) #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if a timezone is not valid | ### mixed transform([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a normalized date into a localized date. #### Parameters | | | | | --- | --- | --- | | [DateTimeInterface](http://php.net/DateTimeInterface) | $dateTime | A DateTimeInterface object | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a \DateTimeInterface | ### mixed reverseTransform(string $rfc3339) Transforms a formatted string following RFC 3339 into a normalized date. #### Parameters | | | | | --- | --- | --- | | string | $rfc3339 | Formatted string | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a string, if the value could not be transformed | symfony ArrayToPartsTransformer ArrayToPartsTransformer ======================== class **ArrayToPartsTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $partMapping) | | | mixed | [transform](#method_transform)($array) Transforms a value from the original representation to a transformed representation. | | | mixed | [reverseTransform](#method_reverseTransform)($array) Transforms a value from the transformed representation to its original representation. | | Details ------- ### \_\_construct(array $partMapping) #### Parameters | | | | | --- | --- | --- | | array | $partMapping | | ### mixed transform($array) Transforms a value from the original representation to a transformed representation. This method is called on two occasions inside a form field: 1. When the form field is initialized with the data attached from the datasource (object or array). 2. When data from a request is submitted using {@link Form::submit()} to transform the new input data back into the renderable format. For example if you have a date field and submit '2009-10-10' you might accept this value because its easily parsed, but the transformer still writes back "2009/10/10" onto the form field (for further displaying or other purposes). This method must be able to deal with empty values. Usually this will be NULL, but depending on your implementation other empty values are possible as well (such as empty strings). The reasoning behind this is that value transformers must be chainable. If the transform() method of the first value transformer outputs NULL, the second value transformer must be able to process that value. By convention, transform() should return an empty string if NULL is passed. #### Parameters | | | | | --- | --- | --- | | | $array | | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | ### mixed reverseTransform($array) Transforms a value from the transformed representation to its original representation. This method is called when {@link Form::submit()} is called to transform the requests tainted data into an acceptable format for your data processing/model layer. This method must be able to deal with empty values. Usually this will be an empty string, but depending on your implementation other empty values are possible as well (such as NULL). The reasoning behind this is that value transformers must be chainable. If the reverseTransform() method of the first value transformer outputs an empty string, the second value transformer must be able to process that value. By convention, reverseTransform() should return NULL if an empty string is passed. #### Parameters | | | | | --- | --- | --- | | | $array | | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | symfony PercentToLocalizedStringTransformer PercentToLocalizedStringTransformer ==================================== class **PercentToLocalizedStringTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a normalized format (integer or float) and a percentage value. Constants --------- | | | | --- | --- | | FRACTIONAL | | | INTEGER | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $types | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(int $scale = null, string $type = null) | | | mixed | [transform](#method_transform)(mixed $value) Transforms between a normalized format (integer or float) into a percentage value. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms between a percentage value into a normalized format (integer or float). | | | [NumberFormatter](http://php.net/NumberFormatter) | [getNumberFormatter](#method_getNumberFormatter)() Returns a preconfigured \NumberFormatter instance. | | Details ------- ### \_\_construct(int $scale = null, string $type = null) #### Parameters | | | | | --- | --- | --- | | int | $scale | The scale | | string | $type | One of the supported types | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the given value of type is unknown | #### See also | | | | --- | --- | | self::$types | for a list of supported types | ### mixed transform(mixed $value) Transforms between a normalized format (integer or float) into a percentage value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not numeric or if the value could not be transformed | ### mixed reverseTransform(mixed $value) Transforms between a percentage value into a normalized format (integer or float). #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a string or if the value could not be transformed | ### protected [NumberFormatter](http://php.net/NumberFormatter) getNumberFormatter() Returns a preconfigured \NumberFormatter instance. #### Return Value | | | | --- | --- | | [NumberFormatter](http://php.net/NumberFormatter) | | symfony BooleanToStringTransformer BooleanToStringTransformer =========================== class **BooleanToStringTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a Boolean and a string. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $trueValue, array $falseValues = array(null)) | | | mixed | [transform](#method_transform)(mixed $value) Transforms a Boolean into a string. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a string into a Boolean. | | Details ------- ### \_\_construct(string $trueValue, array $falseValues = array(null)) #### Parameters | | | | | --- | --- | --- | | string | $trueValue | The value emitted upon transform if the input is true | | array | $falseValues | | ### mixed transform(mixed $value) Transforms a Boolean into a string. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a Boolean | ### mixed reverseTransform(mixed $value) Transforms a string into a Boolean. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a string | symfony MoneyToLocalizedStringTransformer MoneyToLocalizedStringTransformer ================================== class **MoneyToLocalizedStringTransformer** extends [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") Transforms between a normalized format and a localized money string. Constants --------- | | | | --- | --- | | ROUND\_CEILING | *Rounds a number towards positive infinity.* Rounds 1.4 to 2 and -1.4 to -1. | | ROUND\_FLOOR | *Rounds a number towards negative infinity.* Rounds 1.4 to 1 and -1.4 to -2. | | ROUND\_UP | *Rounds a number away from zero.* Rounds 1.4 to 2 and -1.4 to -2. | | ROUND\_DOWN | *Rounds a number towards zero.* Rounds 1.4 to 1 and -1.4 to -1. | | ROUND\_HALF\_EVEN | *Rounds to the nearest number and halves to the next even number.* Rounds 2.5, 1.6 and 1.5 to 2 and 1.4 to 1. | | ROUND\_HALF\_UP | *Rounds to the nearest number and halves away from zero.* Rounds 2.5 to 3, 1.6 and 1.5 to 2 and 1.4 to 1. | | ROUND\_HALF\_DOWN | *Rounds to the nearest number and halves towards zero.* Rounds 2.5 and 1.6 to 2, 1.5 and 1.4 to 1. | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $grouping | | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#property_grouping "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | | protected | $roundingMode | | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#property_roundingMode "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(int $scale = 2, bool|null $grouping = true, int|null $roundingMode = self::ROUND\_HALF\_UP, int|null $divisor = 1) | | | mixed | [transform](#method_transform)(mixed $value) Transforms a normalized format into a localized money string. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a localized money string into a normalized format. | | | [NumberFormatter](http://php.net/NumberFormatter) | [getNumberFormatter](#method_getNumberFormatter)() Returns a preconfigured \NumberFormatter instance. | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#method_getNumberFormatter "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | Details ------- ### \_\_construct(int $scale = 2, bool|null $grouping = true, int|null $roundingMode = self::ROUND\_HALF\_UP, int|null $divisor = 1) #### Parameters | | | | | --- | --- | --- | | int | $scale | | | bool|null | $grouping | | | int|null | $roundingMode | | | int|null | $divisor | | ### mixed transform(mixed $value) Transforms a normalized format into a localized money string. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not numeric or if the value can not be transformed | ### mixed reverseTransform(mixed $value) Transforms a localized money string into a normalized format. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a string or if the value can not be transformed | ### protected [NumberFormatter](http://php.net/NumberFormatter) getNumberFormatter() Returns a preconfigured \NumberFormatter instance. #### Return Value | | | | --- | --- | | [NumberFormatter](http://php.net/NumberFormatter) | | symfony ChoiceToValueTransformer ChoiceToValueTransformer ========================= class **ChoiceToValueTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $choiceList) | | | mixed | [transform](#method_transform)($choice) Transforms a value from the original representation to a transformed representation. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a value from the transformed representation to its original representation. | | Details ------- ### \_\_construct([ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $choiceList) #### Parameters | | | | | --- | --- | --- | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | $choiceList | | ### mixed transform($choice) Transforms a value from the original representation to a transformed representation. This method is called on two occasions inside a form field: 1. When the form field is initialized with the data attached from the datasource (object or array). 2. When data from a request is submitted using {@link Form::submit()} to transform the new input data back into the renderable format. For example if you have a date field and submit '2009-10-10' you might accept this value because its easily parsed, but the transformer still writes back "2009/10/10" onto the form field (for further displaying or other purposes). This method must be able to deal with empty values. Usually this will be NULL, but depending on your implementation other empty values are possible as well (such as empty strings). The reasoning behind this is that value transformers must be chainable. If the transform() method of the first value transformer outputs NULL, the second value transformer must be able to process that value. By convention, transform() should return an empty string if NULL is passed. #### Parameters | | | | | --- | --- | --- | | | $choice | | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | ### mixed reverseTransform(mixed $value) Transforms a value from the transformed representation to its original representation. This method is called when {@link Form::submit()} is called to transform the requests tainted data into an acceptable format for your data processing/model layer. This method must be able to deal with empty values. Usually this will be an empty string, but depending on your implementation other empty values are possible as well (such as NULL). The reasoning behind this is that value transformers must be chainable. If the reverseTransform() method of the first value transformer outputs an empty string, the second value transformer must be able to process that value. By convention, reverseTransform() should return NULL if an empty string is passed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails |
programming_docs
symfony DateTimeToHtml5LocalDateTimeTransformer DateTimeToHtml5LocalDateTimeTransformer ======================================== class **DateTimeToHtml5LocalDateTimeTransformer** extends [BaseDateTimeTransformer](basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") Constants --------- | | | | --- | --- | | HTML5\_FORMAT | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | from [BaseDateTimeTransformer](basedatetimetransformer#property_formats "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $inputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_inputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $outputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_outputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null) | from [BaseDateTimeTransformer](basedatetimetransformer#method___construct "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | mixed | [transform](#method_transform)([DateTime](http://php.net/DateTime)|[DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a \DateTime into a local date and time string. | | | mixed | [reverseTransform](#method_reverseTransform)(string $dateTimeLocal) Transforms a local date and time string into a \DateTime. | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null) #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if a timezone is not valid | ### mixed transform([DateTime](http://php.net/DateTime)|[DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a \DateTime into a local date and time string. According to the HTML standard, the input string of a datetime-local input is a RFC3339 date followed by 'T', followed by a RFC3339 time. https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-local-date-and-time-string #### Parameters | | | | | --- | --- | --- | | [DateTime](http://php.net/DateTime)|[DateTimeInterface](http://php.net/DateTimeInterface) | $dateTime | A DateTime object | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not an instance of \DateTime or \DateTimeInterface | ### mixed reverseTransform(string $dateTimeLocal) Transforms a local date and time string into a \DateTime. When transforming back to DateTime the regex is slightly laxer, taking into account rules for parsing a local date and time string https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-local-date-and-time-string #### Parameters | | | | | --- | --- | --- | | string | $dateTimeLocal | Formatted string | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a string, if the value could not be transformed | symfony DateTimeImmutableToDateTimeTransformer DateTimeImmutableToDateTimeTransformer ======================================= class **DateTimeImmutableToDateTimeTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a DateTimeImmutable object and a DateTime object. Methods ------- | | | | | --- | --- | --- | | mixed | [transform](#method_transform)(mixed $value) Transforms a DateTimeImmutable into a DateTime object. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a DateTime object into a DateTimeImmutable object. | | Details ------- ### mixed transform(mixed $value) Transforms a DateTimeImmutable into a DateTime object. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a \DateTimeImmutable | ### mixed reverseTransform(mixed $value) Transforms a DateTime object into a DateTimeImmutable object. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a \DateTime | symfony ValueToDuplicatesTransformer ValueToDuplicatesTransformer ============================= class **ValueToDuplicatesTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $keys) | | | mixed | [transform](#method_transform)(mixed $value) Duplicates the given value through the array. | | | mixed | [reverseTransform](#method_reverseTransform)($array) Extracts the duplicated value from an array. | | Details ------- ### \_\_construct(array $keys) #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### mixed transform(mixed $value) Duplicates the given value through the array. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | ### mixed reverseTransform($array) Extracts the duplicated value from an array. #### Parameters | | | | | --- | --- | --- | | | $array | | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not an array or if the given array can not be transformed | symfony DateIntervalToArrayTransformer DateIntervalToArrayTransformer =============================== class **DateIntervalToArrayTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a normalized date interval and an interval string/array. Constants --------- | | | | --- | --- | | YEARS | | | MONTHS | | | DAYS | | | HOURS | | | MINUTES | | | SECONDS | | | INVERT | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $fields = null, bool $pad = false) | | | mixed | [transform](#method_transform)([DateInterval](http://php.net/DateInterval) $dateInterval) Transforms a normalized date interval into an interval array. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms an interval array into a normalized date interval. | | Details ------- ### \_\_construct(array $fields = null, bool $pad = false) #### Parameters | | | | | --- | --- | --- | | array | $fields | The date fields | | bool | $pad | Whether to use padding | ### mixed transform([DateInterval](http://php.net/DateInterval) $dateInterval) Transforms a normalized date interval into an interval array. #### Parameters | | | | | --- | --- | --- | | [DateInterval](http://php.net/DateInterval) | $dateInterval | Normalized date interval | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the given value is not a \DateInterval instance | ### mixed reverseTransform(mixed $value) Transforms an interval array into a normalized date interval. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../../../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if the given value is not an array | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the value could not be transformed | symfony DateTimeToArrayTransformer DateTimeToArrayTransformer =========================== class **DateTimeToArrayTransformer** extends [BaseDateTimeTransformer](basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") Transforms between a normalized time and a localized time string/array. Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | from [BaseDateTimeTransformer](basedatetimetransformer#property_formats "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $inputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_inputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $outputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_outputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null, array $fields = null, bool $pad = false) | | | mixed | [transform](#method_transform)([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a normalized date into a localized date. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a localized date into a normalized date. | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null, array $fields = null, bool $pad = false) #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | | array | $fields | The date fields | | bool | $pad | Whether to use padding | ### mixed transform([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a normalized date into a localized date. #### Parameters | | | | | --- | --- | --- | | [DateTimeInterface](http://php.net/DateTimeInterface) | $dateTime | A DateTimeInterface object | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a \DateTimeInterface | ### mixed reverseTransform(mixed $value) Transforms a localized date into a normalized date. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not an array, if the value could not be transformed | symfony NumberToLocalizedStringTransformer NumberToLocalizedStringTransformer =================================== class **NumberToLocalizedStringTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a number type and a localized number with grouping (each thousand) and comma separators. Constants --------- | | | | --- | --- | | ROUND\_CEILING | *Rounds a number towards positive infinity.* Rounds 1.4 to 2 and -1.4 to -1. | | ROUND\_FLOOR | *Rounds a number towards negative infinity.* Rounds 1.4 to 1 and -1.4 to -2. | | ROUND\_UP | *Rounds a number away from zero.* Rounds 1.4 to 2 and -1.4 to -2. | | ROUND\_DOWN | *Rounds a number towards zero.* Rounds 1.4 to 1 and -1.4 to -1. | | ROUND\_HALF\_EVEN | *Rounds to the nearest number and halves to the next even number.* Rounds 2.5, 1.6 and 1.5 to 2 and 1.4 to 1. | | ROUND\_HALF\_UP | *Rounds to the nearest number and halves away from zero.* Rounds 2.5 to 3, 1.6 and 1.5 to 2 and 1.4 to 1. | | ROUND\_HALF\_DOWN | *Rounds to the nearest number and halves towards zero.* Rounds 2.5 and 1.6 to 2, 1.5 and 1.4 to 1. | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $grouping | | | | protected | $roundingMode | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(int $scale = null, bool|null $grouping = false, int|null $roundingMode = self::ROUND\_HALF\_UP) | | | mixed | [transform](#method_transform)(mixed $value) Transforms a number type into localized number. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a localized number into an integer or float. | | | [NumberFormatter](http://php.net/NumberFormatter) | [getNumberFormatter](#method_getNumberFormatter)() Returns a preconfigured \NumberFormatter instance. | | Details ------- ### \_\_construct(int $scale = null, bool|null $grouping = false, int|null $roundingMode = self::ROUND\_HALF\_UP) #### Parameters | | | | | --- | --- | --- | | int | $scale | | | bool|null | $grouping | | | int|null | $roundingMode | | ### mixed transform(mixed $value) Transforms a number type into localized number. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not numeric or if the value can not be transformed | ### mixed reverseTransform(mixed $value) Transforms a localized number into an integer or float. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a string or if the value can not be transformed | ### protected [NumberFormatter](http://php.net/NumberFormatter) getNumberFormatter() Returns a preconfigured \NumberFormatter instance. #### Return Value | | | | --- | --- | | [NumberFormatter](http://php.net/NumberFormatter) | | symfony DateTimeToStringTransformer DateTimeToStringTransformer ============================ class **DateTimeToStringTransformer** extends [BaseDateTimeTransformer](basedatetimetransformer "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") Transforms between a date string and a DateTime object. Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | from [BaseDateTimeTransformer](basedatetimetransformer#property_formats "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $inputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_inputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | | protected | $outputTimezone | | from [BaseDateTimeTransformer](basedatetimetransformer#property_outputTimezone "Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null, string $format = 'Y-m-d H:i:s') Transforms a \DateTime instance to a string. | | | mixed | [transform](#method_transform)([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a DateTime object into a date string with the configured format and timezone. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a date string in the configured timezone into a DateTime object. | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null, string $format = 'Y-m-d H:i:s') Transforms a \DateTime instance to a string. #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | | string | $format | The date format | #### See also | | | | --- | --- | | \DateTime::format() | for supported formats | ### mixed transform([DateTimeInterface](http://php.net/DateTimeInterface) $dateTime) Transforms a DateTime object into a date string with the configured format and timezone. #### Parameters | | | | | --- | --- | --- | | [DateTimeInterface](http://php.net/DateTimeInterface) | $dateTime | A DateTimeInterface object | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a \DateTimeInterface | ### mixed reverseTransform(mixed $value) Transforms a date string in the configured timezone into a DateTime object. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | If the given value is not a string, or could not be transformed |
programming_docs
symfony DateTimeZoneToStringTransformer DateTimeZoneToStringTransformer ================================ class **DateTimeZoneToStringTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Transforms between a timezone identifier string and a DateTimeZone object. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(bool $multiple = false) | | | mixed | [transform](#method_transform)($dateTimeZone) Transforms a value from the original representation to a transformed representation. | | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a value from the transformed representation to its original representation. | | Details ------- ### \_\_construct(bool $multiple = false) #### Parameters | | | | | --- | --- | --- | | bool | $multiple | | ### mixed transform($dateTimeZone) Transforms a value from the original representation to a transformed representation. This method is called on two occasions inside a form field: 1. When the form field is initialized with the data attached from the datasource (object or array). 2. When data from a request is submitted using {@link Form::submit()} to transform the new input data back into the renderable format. For example if you have a date field and submit '2009-10-10' you might accept this value because its easily parsed, but the transformer still writes back "2009/10/10" onto the form field (for further displaying or other purposes). This method must be able to deal with empty values. Usually this will be NULL, but depending on your implementation other empty values are possible as well (such as empty strings). The reasoning behind this is that value transformers must be chainable. If the transform() method of the first value transformer outputs NULL, the second value transformer must be able to process that value. By convention, transform() should return an empty string if NULL is passed. #### Parameters | | | | | --- | --- | --- | | | $dateTimeZone | | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | ### mixed reverseTransform(mixed $value) Transforms a value from the transformed representation to its original representation. This method is called when {@link Form::submit()} is called to transform the requests tainted data into an acceptable format for your data processing/model layer. This method must be able to deal with empty values. Usually this will be an empty string, but depending on your implementation other empty values are possible as well (such as NULL). The reasoning behind this is that value transformers must be chainable. If the reverseTransform() method of the first value transformer outputs an empty string, the second value transformer must be able to process that value. By convention, reverseTransform() should return NULL if an empty string is passed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | symfony BaseDateTimeTransformer BaseDateTimeTransformer ======================== abstract class **BaseDateTimeTransformer** implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $formats | | | | protected | $inputTimezone | | | | protected | $outputTimezone | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $inputTimezone = null, string $outputTimezone = null) | | Details ------- ### \_\_construct(string $inputTimezone = null, string $outputTimezone = null) #### Parameters | | | | | --- | --- | --- | | string | $inputTimezone | The name of the input timezone | | string | $outputTimezone | The name of the output timezone | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if a timezone is not valid | symfony IntegerToLocalizedStringTransformer IntegerToLocalizedStringTransformer ==================================== class **IntegerToLocalizedStringTransformer** extends [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") Transforms between an integer and a localized number with grouping (each thousand) and comma separators. Constants --------- | | | | --- | --- | | ROUND\_CEILING | *Rounds a number towards positive infinity.* Rounds 1.4 to 2 and -1.4 to -1. | | ROUND\_FLOOR | *Rounds a number towards negative infinity.* Rounds 1.4 to 1 and -1.4 to -2. | | ROUND\_UP | *Rounds a number away from zero.* Rounds 1.4 to 2 and -1.4 to -2. | | ROUND\_DOWN | *Rounds a number towards zero.* Rounds 1.4 to 1 and -1.4 to -1. | | ROUND\_HALF\_EVEN | *Rounds to the nearest number and halves to the next even number.* Rounds 2.5, 1.6 and 1.5 to 2 and 1.4 to 1. | | ROUND\_HALF\_UP | *Rounds to the nearest number and halves away from zero.* Rounds 2.5 to 3, 1.6 and 1.5 to 2 and 1.4 to 1. | | ROUND\_HALF\_DOWN | *Rounds to the nearest number and halves towards zero.* Rounds 2.5 and 1.6 to 2, 1.5 and 1.4 to 1. | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $grouping | | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#property_grouping "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | | protected | $roundingMode | | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#property_roundingMode "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(int $scale = 0, bool|null $grouping = false, int|null $roundingMode = self::ROUND\_DOWN) Constructs a transformer. | | | mixed | [transform](#method_transform)(mixed $value) Transforms a number type into localized number. | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#method_transform "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | | mixed | [reverseTransform](#method_reverseTransform)(mixed $value) Transforms a localized number into an integer or float. | | | [NumberFormatter](http://php.net/NumberFormatter) | [getNumberFormatter](#method_getNumberFormatter)() Returns a preconfigured \NumberFormatter instance. | from [NumberToLocalizedStringTransformer](numbertolocalizedstringtransformer#method_getNumberFormatter "Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer") | Details ------- ### \_\_construct(int $scale = 0, bool|null $grouping = false, int|null $roundingMode = self::ROUND\_DOWN) Constructs a transformer. #### Parameters | | | | | --- | --- | --- | | int | $scale | | | bool|null | $grouping | | | int|null | $roundingMode | | ### mixed transform(mixed $value) Transforms a number type into localized number. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the original representation | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not numeric or if the value can not be transformed | ### mixed reverseTransform(mixed $value) Transforms a localized number into an integer or float. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value in the transformed representation | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | if the given value is not a string or if the value can not be transformed | ### protected [NumberFormatter](http://php.net/NumberFormatter) getNumberFormatter() Returns a preconfigured \NumberFormatter instance. #### Return Value | | | | --- | --- | | [NumberFormatter](http://php.net/NumberFormatter) | | symfony UrlType UrlType ======== class **UrlType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony ColorType ColorType ========== class **ColorType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony NumberType NumberType =========== class **NumberType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise |
programming_docs
symfony ChoiceType ChoiceType =========== class **ChoiceType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | | | [\_\_construct](#method___construct)([ChoiceListFactoryInterface](../../../choicelist/factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $choiceListFactory = null) | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### \_\_construct([ChoiceListFactoryInterface](../../../choicelist/factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $choiceListFactory = null) #### Parameters | | | | | --- | --- | --- | | [ChoiceListFactoryInterface](../../../choicelist/factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | $choiceListFactory | | symfony LocaleType LocaleType =========== class **LocaleType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [ChoiceLoaderInterface](../../../choicelist/loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) deprecated Loads a list of choices. | | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) deprecated Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) deprecated Loads the values corresponding to the given choices. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony ButtonType ButtonType =========== class **ButtonType** extends [BaseType](basetype "Symfony\Component\Form\Extension\Core\Type\BaseType") implements [ButtonTypeInterface](../../../buttontypeinterface "Symfony\Component\Form\ButtonTypeInterface") A form button. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [BaseType](basetype#method_buildForm "Symfony\Component\Form\Extension\Core\Type\BaseType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [BaseType](basetype#method_buildView "Symfony\Component\Form\Extension\Core\Type\BaseType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony TelType TelType ======== class **TelType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise |
programming_docs
symfony CountryType CountryType ============ class **CountryType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [ChoiceLoaderInterface](../../../choicelist/loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) deprecated Loads a list of choices. | | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) deprecated Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) deprecated Loads the values corresponding to the given choices. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony FormType FormType ========= class **FormType** extends [BaseType](basetype "Symfony\Component\Form\Extension\Core\Type\BaseType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | | | [\_\_construct](#method___construct)([PropertyAccessorInterface](../../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null) | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### \_\_construct([PropertyAccessorInterface](../../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessorInterface](../../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") | $propertyAccessor | | symfony SearchType SearchType =========== class **SearchType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony CurrencyType CurrencyType ============= class **CurrencyType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [ChoiceLoaderInterface](../../../choicelist/loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) deprecated Loads a list of choices. | | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) deprecated Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) deprecated Loads the values corresponding to the given choices. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values |
programming_docs
symfony PasswordType PasswordType ============= class **PasswordType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony HiddenType HiddenType =========== class **HiddenType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony FileType FileType ========= class **FileType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony DateTimeType DateTimeType ============= class **DateTimeType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Constants --------- | | | | --- | --- | | DEFAULT\_DATE\_FORMAT | | | DEFAULT\_TIME\_FORMAT | | | HTML5\_FORMAT | *The HTML5 datetime-local format as defined in http://w3c.github.io/html-reference/datatypes.html#form.data.datetime-local.* | Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony RangeType RangeType ========== class **RangeType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise |
programming_docs
symfony ResetType ResetType ========== class **ResetType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [ButtonTypeInterface](../../../buttontypeinterface "Symfony\Component\Form\ButtonTypeInterface") A reset button. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony SubmitType SubmitType =========== class **SubmitType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [SubmitButtonTypeInterface](../../../submitbuttontypeinterface "Symfony\Component\Form\SubmitButtonTypeInterface") A submit button. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony MoneyType MoneyType ========== class **MoneyType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $patterns | | | Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | | static | [getPattern](#method_getPattern)($currency) Returns the pattern for this locale in UTF-8. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### static protected getPattern($currency) Returns the pattern for this locale in UTF-8. The pattern contains the placeholder "{{ widget }}" where the HTML tag should be inserted #### Parameters | | | | | --- | --- | --- | | | $currency | | symfony CheckboxType CheckboxType ============= class **CheckboxType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony DateType DateType ========= class **DateType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Constants --------- | | | | --- | --- | | DEFAULT\_FORMAT | | | HTML5\_FORMAT | | Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise |
programming_docs
symfony PercentType PercentType ============ class **PercentType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony TimeType TimeType ========= class **TimeType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony TextareaType TextareaType ============= class **TextareaType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony BaseType BaseType ========= abstract class **BaseType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Encapsulates common logic of {@link FormType} and {@link ButtonType}. This type does not appear in the form's type inheritance chain and as such cannot be extended (via {@link \Symfony\Component\Form\FormExtensionInterface}) nor themed. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | from [AbstractType](../../../abstracttype#method_getBlockPrefix "Symfony\Component\Form\AbstractType") | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony DateIntervalType DateIntervalType ================= class **DateIntervalType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise |
programming_docs
symfony LanguageType LanguageType ============= class **LanguageType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [ChoiceLoaderInterface](../../../choicelist/loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) deprecated Loads a list of choices. | | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) deprecated Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) deprecated Loads the values corresponding to the given choices. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../../../choicelist/choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) deprecated deprecated | since | Symfony 4.1 | Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony IntegerType IntegerType ============ class **IntegerType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony RadioType RadioType ========== class **RadioType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony TimezoneType TimezoneType ============= class **TimezoneType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise |
programming_docs
symfony EmailType EmailType ========== class **EmailType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractType](../../../abstracttype#method_configureOptions "Symfony\Component\Form\AbstractType") | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony CollectionType CollectionType =============== class **CollectionType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony RepeatedType RepeatedType ============= class **RepeatedType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony BirthdayType BirthdayType ============= class **BirthdayType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractType](../../../abstracttype#method_buildForm "Symfony\Component\Form\AbstractType") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | symfony TextType TextType ========= class **TextType** extends [AbstractType](../../../abstracttype "Symfony\Component\Form\AbstractType") implements [DataTransformerInterface](../../../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. | from [AbstractType](../../../abstracttype#method_buildView "Symfony\Component\Form\AbstractType") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. | from [AbstractType](../../../abstracttype#method_finishView "Symfony\Component\Form\AbstractType") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getBlockPrefix](#method_getBlockPrefix)() Returns the prefix of the template block name for this type. | | | string|null | [getParent](#method_getParent)() Returns the name of the parent type. | from [AbstractType](../../../abstracttype#method_getParent "Symfony\Component\Form\AbstractType") | | mixed | [transform](#method_transform)($data) Transforms a value from the original representation to a transformed representation. | | | mixed | [reverseTransform](#method_reverseTransform)($data) Transforms a value from the transformed representation to its original representation. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the form. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | The form builder | | array | $options | The options | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the form view. This method is called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. A view of a form is built before the views of the child forms are built. This means that you cannot access child views in this method. If you need to do so, move your logic to {@link finishView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the form view. This method gets called for each type in the hierarchy starting from the top most type. Type extensions can further modify the view. When this method is called, views of the form's children have already been built and finished and can be accessed. You should only implement such logic in this method that actually accesses child views. For everything else you are recommended to implement {@link buildView()} instead. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | The view | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form | | array | $options | The options | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getBlockPrefix() Returns the prefix of the template block name for this type. The block prefix defaults to the underscored short class name with the "Type" suffix removed (e.g. "UserProfileType" => "user\_profile"). #### Return Value | | | | --- | --- | | string | The prefix of the template block name | ### string|null getParent() Returns the name of the parent type. #### Return Value | | | | --- | --- | | string|null | The name of the parent type if any, null otherwise | ### mixed transform($data) Transforms a value from the original representation to a transformed representation. This method is called on two occasions inside a form field: 1. When the form field is initialized with the data attached from the datasource (object or array). 2. When data from a request is submitted using {@link Form::submit()} to transform the new input data back into the renderable format. For example if you have a date field and submit '2009-10-10' you might accept this value because its easily parsed, but the transformer still writes back "2009/10/10" onto the form field (for further displaying or other purposes). This method must be able to deal with empty values. Usually this will be NULL, but depending on your implementation other empty values are possible as well (such as empty strings). The reasoning behind this is that value transformers must be chainable. If the transform() method of the first value transformer outputs NULL, the second value transformer must be able to process that value. By convention, transform() should return an empty string if NULL is passed. #### Parameters | | | | | --- | --- | --- | | | $data | | #### Return Value | | | | --- | --- | | mixed | The value in the transformed representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails | ### mixed reverseTransform($data) Transforms a value from the transformed representation to its original representation. This method is called when {@link Form::submit()} is called to transform the requests tainted data into an acceptable format for your data processing/model layer. This method must be able to deal with empty values. Usually this will be an empty string, but depending on your implementation other empty values are possible as well (such as NULL). The reasoning behind this is that value transformers must be chainable. If the reverseTransform() method of the first value transformer outputs an empty string, the second value transformer must be able to process that value. By convention, reverseTransform() should return NULL if an empty string is passed. #### Parameters | | | | | --- | --- | --- | | | $data | | #### Return Value | | | | --- | --- | | mixed | The value in the original representation | #### Exceptions | | | | --- | --- | | [TransformationFailedException](../../../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException") | when the transformation fails |
programming_docs
symfony MergeCollectionListener MergeCollectionListener ======================== class **MergeCollectionListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(bool $allowAdd = false, bool $allowDelete = false) | | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | | | [onSubmit](#method_onSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | Details ------- ### \_\_construct(bool $allowAdd = false, bool $allowDelete = false) #### Parameters | | | | | --- | --- | --- | | bool | $allowAdd | Whether values might be added to the collection | | bool | $allowDelete | Whether values might be removed from the collection | ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | ### onSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | symfony TrimListener TrimListener ============= class **TrimListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Trims string data. Methods ------- | | | | | --- | --- | --- | | | [preSubmit](#method_preSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | Details ------- ### preSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | symfony FixUrlProtocolListener FixUrlProtocolListener ======================= class **FixUrlProtocolListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Adds a protocol to a URL if it doesn't already have one. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|null $defaultProtocol = 'http') | | | | [onSubmit](#method_onSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | Details ------- ### \_\_construct(string|null $defaultProtocol = 'http') #### Parameters | | | | | --- | --- | --- | | string|null | $defaultProtocol | The URL scheme to add when there is none or null to not modify the data | ### onSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | symfony ResizeFormListener ResizeFormListener =================== class **ResizeFormListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Resize a collection form element based on the data sent from the client. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $type | | | | protected | $options | | | | protected | $allowAdd | | | | protected | $allowDelete | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $type, array $options = array(), bool $allowAdd = false, bool $allowDelete = false, bool|callable $deleteEmpty = false) | | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | | | [preSetData](#method_preSetData)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | | | [preSubmit](#method_preSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | | | [onSubmit](#method_onSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | Details ------- ### \_\_construct(string $type, array $options = array(), bool $allowAdd = false, bool $allowDelete = false, bool|callable $deleteEmpty = false) #### Parameters | | | | | --- | --- | --- | | string | $type | | | array | $options | | | bool | $allowAdd | Whether children could be added to the group | | bool | $allowDelete | Whether children could be removed from the group | | bool|callable | $deleteEmpty | | ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | ### preSetData([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | ### preSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | ### onSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | symfony ValidatorTypeGuesser ValidatorTypeGuesser ===================== class **ValidatorTypeGuesser** implements [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([MetadataFactoryInterface](../../../validator/mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory) | | | [TypeGuess](../../guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | [guessType](#method_guessType)(string $class, string $property) Returns a field guess for a property name of a class. | | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | [guessRequired](#method_guessRequired)(string $class, string $property) Returns a guess whether a property of a class is required. | | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessMaxLength](#method_guessMaxLength)(string $class, string $property) Returns a guess about the field's maximum length. | | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessPattern](#method_guessPattern)(string $class, string $property) Returns a guess about the field's pattern. | | | [TypeGuess](../../guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | [guessTypeForConstraint](#method_guessTypeForConstraint)([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses a field class name for a given constraint. | | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessRequiredForConstraint](#method_guessRequiredForConstraint)([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses whether a field is required based on the given constraint. | | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessMaxLengthForConstraint](#method_guessMaxLengthForConstraint)([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses a field's maximum length based on the given constraint. | | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | [guessPatternForConstraint](#method_guessPatternForConstraint)([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses a field's pattern based on the given constraint. | | | [Guess](../../guess/guess "Symfony\Component\Form\Guess\Guess")|null | [guess](#method_guess)(string $class, string $property, [Closure](http://php.net/Closure) $closure, mixed $defaultValue = null) Iterates over the constraints of a property, executes a constraints on them and returns the best guess. | | Details ------- ### \_\_construct([MetadataFactoryInterface](../../../validator/mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory) #### Parameters | | | | | --- | --- | --- | | [MetadataFactoryInterface](../../../validator/mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | $metadataFactory | | ### [TypeGuess](../../guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null guessType(string $class, string $property) Returns a field guess for a property name of a class. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [TypeGuess](../../guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | A guess for the field's type and options | ### [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") guessRequired(string $class, string $property) Returns a guess whether a property of a class is required. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess") | A guess for the field's required setting | ### [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessMaxLength(string $class, string $property) Returns a guess about the field's maximum length. #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | A guess for the field's maximum length | ### [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessPattern(string $class, string $property) Returns a guess about the field's pattern. * When you have a min value, you guess a min length of this min (LOW\_CONFIDENCE) , lines below * If this value is a float type, this is wrong so you guess null with MEDIUM\_CONFIDENCE to override the previous guess. Example: You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5) #### Parameters | | | | | --- | --- | --- | | string | $class | The fully qualified class name | | string | $property | The name of the property to guess for | #### Return Value | | | | --- | --- | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | A guess for the field's required pattern | ### [TypeGuess](../../guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null guessTypeForConstraint([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses a field class name for a given constraint. #### Parameters | | | | | --- | --- | --- | | [Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [TypeGuess](../../guess/typeguess "Symfony\Component\Form\Guess\TypeGuess")|null | The guessed field class and options | ### [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessRequiredForConstraint([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses whether a field is required based on the given constraint. #### Parameters | | | | | --- | --- | --- | | [Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | The guess whether the field is required | ### [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessMaxLengthForConstraint([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses a field's maximum length based on the given constraint. #### Parameters | | | | | --- | --- | --- | | [Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | The guess for the maximum length | ### [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null guessPatternForConstraint([Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Guesses a field's pattern based on the given constraint. #### Parameters | | | | | --- | --- | --- | | [Constraint](../../../validator/constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [ValueGuess](../../guess/valueguess "Symfony\Component\Form\Guess\ValueGuess")|null | The guess for the pattern | ### protected [Guess](../../guess/guess "Symfony\Component\Form\Guess\Guess")|null guess(string $class, string $property, [Closure](http://php.net/Closure) $closure, mixed $defaultValue = null) Iterates over the constraints of a property, executes a constraints on them and returns the best guess. #### Parameters | | | | | --- | --- | --- | | string | $class | The class to read the constraints from | | string | $property | The property for which to find constraints | | [Closure](http://php.net/Closure) | $closure | The closure that returns a guess for a given constraint | | mixed | $defaultValue | The default value assumed if no other value can be guessed | #### Return Value | | | | --- | --- | | [Guess](../../guess/guess "Symfony\Component\Form\Guess\Guess")|null | The guessed value with the highest confidence | symfony Symfony\Component\Form\Extension\Validator\Constraints Symfony\Component\Form\Extension\Validator\Constraints ====================================================== Classes ------- | | | | --- | --- | | [Form](constraints/form "Symfony\Component\Form\Extension\Validator\Constraints\Form") | | | [FormValidator](constraints/formvalidator "Symfony\Component\Form\Extension\Validator\Constraints\FormValidator") | | symfony Symfony\Component\Form\Extension\Validator\Util Symfony\Component\Form\Extension\Validator\Util =============================================== Classes ------- | | | | --- | --- | | [ServerParams](util/serverparams "Symfony\Component\Form\Extension\Validator\Util\ServerParams") | | symfony Symfony\Component\Form\Extension\Validator\Type Symfony\Component\Form\Extension\Validator\Type =============================================== Classes ------- | | | | --- | --- | | [BaseValidatorExtension](type/basevalidatorextension "Symfony\Component\Form\Extension\Validator\Type\BaseValidatorExtension") | Encapsulates common logic of {@link FormTypeValidatorExtension} and {@link SubmitTypeValidatorExtension}. | | [FormTypeValidatorExtension](type/formtypevalidatorextension "Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension") | | | [RepeatedTypeValidatorExtension](type/repeatedtypevalidatorextension "Symfony\Component\Form\Extension\Validator\Type\RepeatedTypeValidatorExtension") | | | [SubmitTypeValidatorExtension](type/submittypevalidatorextension "Symfony\Component\Form\Extension\Validator\Type\SubmitTypeValidatorExtension") | | | [UploadValidatorExtension](type/uploadvalidatorextension "Symfony\Component\Form\Extension\Validator\Type\UploadValidatorExtension") | | symfony ValidatorExtension ValidatorExtension =================== class **ValidatorExtension** extends [AbstractExtension](../../abstractextension "Symfony\Component\Form\AbstractExtension") Extension supporting the Symfony Validator component in forms. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | from [AbstractExtension](../../abstractextension#method_getType "Symfony\Component\Form\AbstractExtension") | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | from [AbstractExtension](../../abstractextension#method_hasType "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | from [AbstractExtension](../../abstractextension#method_getTypeExtensions "Symfony\Component\Form\AbstractExtension") | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | from [AbstractExtension](../../abstractextension#method_hasTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | from [AbstractExtension](../../abstractextension#method_getTypeGuesser "Symfony\Component\Form\AbstractExtension") | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | from [AbstractExtension](../../abstractextension#method_loadTypes "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | | | | [\_\_construct](#method___construct)([ValidatorInterface](../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator) | | Details ------- ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | ### \_\_construct([ValidatorInterface](../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator) #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | |
programming_docs
symfony Symfony\Component\Form\Extension\Validator\ViolationMapper Symfony\Component\Form\Extension\Validator\ViolationMapper ========================================================== Classes ------- | | | | --- | --- | | [MappingRule](violationmapper/mappingrule "Symfony\Component\Form\Extension\Validator\ViolationMapper\MappingRule") | | | [RelativePath](violationmapper/relativepath "Symfony\Component\Form\Extension\Validator\ViolationMapper\RelativePath") | | | [ViolationMapper](violationmapper/violationmapper "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper") | | | [ViolationPath](violationmapper/violationpath "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath") | | | [ViolationPathIterator](violationmapper/violationpathiterator "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator") | | Interfaces ---------- | | | | --- | --- | | *[ViolationMapperInterface](violationmapper/violationmapperinterface "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface")* | | symfony Symfony\Component\Form\Extension\Validator\EventListener Symfony\Component\Form\Extension\Validator\EventListener ======================================================== Classes ------- | | | | --- | --- | | [ValidationListener](eventlistener/validationlistener "Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener") | | symfony RelativePath RelativePath ============= class **RelativePath** extends [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") Constants --------- | | | | --- | --- | | SINGULAR\_SEPARATOR | *Character used for separating between plural and singular of an element.* | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $root, [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath")|string $propertyPath) Constructs a property path from a string. | | | string | [\_\_toString](#method___toString)() Returns the string representation of the property path. | from [PropertyPath](../../../../propertyaccess/propertypath#method___toString "Symfony\Component\PropertyAccess\PropertyPath") | | int | [getLength](#method_getLength)() Returns the length of the property path, i.e. the number of elements. | from [PropertyPath](../../../../propertyaccess/propertypath#method_getLength "Symfony\Component\PropertyAccess\PropertyPath") | | [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") | [getParent](#method_getParent)() Returns the parent property path. | from [PropertyPath](../../../../propertyaccess/propertypath#method_getParent "Symfony\Component\PropertyAccess\PropertyPath") | | [PropertyPathIteratorInterface](../../../../propertyaccess/propertypathiteratorinterface "Symfony\Component\PropertyAccess\PropertyPathIteratorInterface") | [getIterator](#method_getIterator)() Returns a new iterator for this path. | from [PropertyPath](../../../../propertyaccess/propertypath#method_getIterator "Symfony\Component\PropertyAccess\PropertyPath") | | array | [getElements](#method_getElements)() Returns the elements of the property path as array. | from [PropertyPath](../../../../propertyaccess/propertypath#method_getElements "Symfony\Component\PropertyAccess\PropertyPath") | | string | [getElement](#method_getElement)(int $index) Returns the element at the given index in the property path. | from [PropertyPath](../../../../propertyaccess/propertypath#method_getElement "Symfony\Component\PropertyAccess\PropertyPath") | | bool | [isProperty](#method_isProperty)(int $index) Returns whether the element at the given index is a property. | from [PropertyPath](../../../../propertyaccess/propertypath#method_isProperty "Symfony\Component\PropertyAccess\PropertyPath") | | bool | [isIndex](#method_isIndex)(int $index) Returns whether the element at the given index is an array index. | from [PropertyPath](../../../../propertyaccess/propertypath#method_isIndex "Symfony\Component\PropertyAccess\PropertyPath") | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | [getRoot](#method_getRoot)() | | Details ------- ### \_\_construct([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $root, [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath")|string $propertyPath) Constructs a property path from a string. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $root | | | [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath")|string | $propertyPath | The property path as string or instance | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../../propertyaccess/exception/invalidargumentexception "Symfony\Component\PropertyAccess\Exception\InvalidArgumentException") | If the given path is not a string | | [InvalidPropertyPathException](../../../../propertyaccess/exception/invalidpropertypathexception "Symfony\Component\PropertyAccess\Exception\InvalidPropertyPathException") | If the syntax of the property path is not valid | ### string \_\_toString() Returns the string representation of the property path. #### Return Value | | | | --- | --- | | string | The path as string | ### int getLength() Returns the length of the property path, i.e. the number of elements. #### Return Value | | | | --- | --- | | int | The path length | ### [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") getParent() Returns the parent property path. The parent property path is the one that contains the same items as this one except for the last one. If this property path only contains one item, null is returned. #### Return Value | | | | --- | --- | | [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") | The parent path or null | ### [PropertyPathIteratorInterface](../../../../propertyaccess/propertypathiteratorinterface "Symfony\Component\PropertyAccess\PropertyPathIteratorInterface") getIterator() Returns a new iterator for this path. #### Return Value | | | | --- | --- | | [PropertyPathIteratorInterface](../../../../propertyaccess/propertypathiteratorinterface "Symfony\Component\PropertyAccess\PropertyPathIteratorInterface") | | ### array getElements() Returns the elements of the property path as array. #### Return Value | | | | --- | --- | | array | An array of property/index names | ### string getElement(int $index) Returns the element at the given index in the property path. #### Parameters | | | | | --- | --- | --- | | int | $index | The index key | #### Return Value | | | | --- | --- | | string | A property or index name | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../../propertyaccess/exception/outofboundsexception "Symfony\Component\PropertyAccess\Exception\OutOfBoundsException") | If the offset is invalid | ### bool isProperty(int $index) Returns whether the element at the given index is a property. #### Parameters | | | | | --- | --- | --- | | int | $index | The index in the property path | #### Return Value | | | | --- | --- | | bool | Whether the element at this index is a property | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../../propertyaccess/exception/outofboundsexception "Symfony\Component\PropertyAccess\Exception\OutOfBoundsException") | If the offset is invalid | ### bool isIndex(int $index) Returns whether the element at the given index is an array index. #### Parameters | | | | | --- | --- | --- | | int | $index | The index in the property path | #### Return Value | | | | --- | --- | | bool | Whether the element at this index is an array index | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../../propertyaccess/exception/outofboundsexception "Symfony\Component\PropertyAccess\Exception\OutOfBoundsException") | If the offset is invalid | ### [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") getRoot() #### Return Value | | | | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | | symfony ViolationMapperInterface ViolationMapperInterface ========================= interface **ViolationMapperInterface** Methods ------- | | | | | --- | --- | --- | | | [mapViolation](#method_mapViolation)([ConstraintViolation](../../../../validator/constraintviolation "Symfony\Component\Validator\ConstraintViolation") $violation, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, bool $allowNonSynchronized = false) Maps a constraint violation to a form in the form tree under the given form. | | Details ------- ### mapViolation([ConstraintViolation](../../../../validator/constraintviolation "Symfony\Component\Validator\ConstraintViolation") $violation, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, bool $allowNonSynchronized = false) Maps a constraint violation to a form in the form tree under the given form. #### Parameters | | | | | --- | --- | --- | | [ConstraintViolation](../../../../validator/constraintviolation "Symfony\Component\Validator\ConstraintViolation") | $violation | The violation to map | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The root form of the tree to map it to | | bool | $allowNonSynchronized | Whether to allow mapping to non-synchronized forms | symfony ViolationPath ViolationPath ============== class **ViolationPath** implements [IteratorAggregate](http://php.net/IteratorAggregate), [PropertyPathInterface](../../../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $violationPath) Creates a new violation path from a string. | | | string | [\_\_toString](#method___toString)() Returns the string representation of the property path. | | | int | [getLength](#method_getLength)() Returns the length of the property path, i.e. the number of elements. | | | [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") | [getParent](#method_getParent)() Returns the parent property path. | | | array | [getElements](#method_getElements)() Returns the elements of the property path as array. | | | string | [getElement](#method_getElement)(int $index) Returns the element at the given index in the property path. | | | bool | [isProperty](#method_isProperty)(int $index) Returns whether the element at the given index is a property. | | | bool | [isIndex](#method_isIndex)(int $index) Returns whether the element at the given index is an array index. | | | bool | [mapsForm](#method_mapsForm)(int $index) Returns whether an element maps directly to a form. | | | [ViolationPathIterator](violationpathiterator "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator") | [getIterator](#method_getIterator)() Returns a new iterator for this path. | | Details ------- ### \_\_construct(string $violationPath) Creates a new violation path from a string. #### Parameters | | | | | --- | --- | --- | | string | $violationPath | The property path of a {@link \Symfony\Component\Validator\ConstraintViolation} object | ### string \_\_toString() Returns the string representation of the property path. #### Return Value | | | | --- | --- | | string | The path as string | ### int getLength() Returns the length of the property path, i.e. the number of elements. #### Return Value | | | | --- | --- | | int | The path length | ### [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") getParent() Returns the parent property path. The parent property path is the one that contains the same items as this one except for the last one. If this property path only contains one item, null is returned. #### Return Value | | | | --- | --- | | [PropertyPath](../../../../propertyaccess/propertypath "Symfony\Component\PropertyAccess\PropertyPath") | The parent path or null | ### array getElements() Returns the elements of the property path as array. #### Return Value | | | | --- | --- | | array | An array of property/index names | ### string getElement(int $index) Returns the element at the given index in the property path. #### Parameters | | | | | --- | --- | --- | | int | $index | The index key | #### Return Value | | | | --- | --- | | string | A property or index name | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../../propertyaccess/exception/outofboundsexception "Symfony\Component\PropertyAccess\Exception\OutOfBoundsException") | If the offset is invalid | ### bool isProperty(int $index) Returns whether the element at the given index is a property. #### Parameters | | | | | --- | --- | --- | | int | $index | The index in the property path | #### Return Value | | | | --- | --- | | bool | Whether the element at this index is a property | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../../propertyaccess/exception/outofboundsexception "Symfony\Component\PropertyAccess\Exception\OutOfBoundsException") | If the offset is invalid | ### bool isIndex(int $index) Returns whether the element at the given index is an array index. #### Parameters | | | | | --- | --- | --- | | int | $index | The index in the property path | #### Return Value | | | | --- | --- | | bool | Whether the element at this index is an array index | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../../propertyaccess/exception/outofboundsexception "Symfony\Component\PropertyAccess\Exception\OutOfBoundsException") | If the offset is invalid | ### bool mapsForm(int $index) Returns whether an element maps directly to a form. Consider the following violation path: ``` children[address].children[office].data.street ``` In this example, "address" and "office" map to forms, while "street does not. #### Parameters | | | | | --- | --- | --- | | int | $index | The element index | #### Return Value | | | | --- | --- | | bool | Whether the element maps to a form | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](../../../exception/outofboundsexception "Symfony\Component\Form\Exception\OutOfBoundsException") | if the offset is invalid | ### [ViolationPathIterator](violationpathiterator "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator") getIterator() Returns a new iterator for this path. #### Return Value | | | | --- | --- | | [ViolationPathIterator](violationpathiterator "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator") | | symfony MappingRule MappingRule ============ class **MappingRule** Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $origin, string $propertyPath, string $targetPath) | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | [getOrigin](#method_getOrigin)() | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")|null | [match](#method_match)(string $propertyPath) Matches a property path against the rule path. | | | bool | [isPrefix](#method_isPrefix)(string $propertyPath) Matches a property path against a prefix of the rule path. | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | [getTarget](#method_getTarget)() | | Details ------- ### \_\_construct([FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $origin, string $propertyPath, string $targetPath) #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $origin | | | string | $propertyPath | | | string | $targetPath | | ### [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") getOrigin() #### Return Value | | | | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | | ### [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")|null match(string $propertyPath) Matches a property path against the rule path. If the rule matches, the form mapped by the rule is returned. Otherwise this method returns false. #### Parameters | | | | | --- | --- | --- | | string | $propertyPath | The property path to match against the rule | #### Return Value | | | | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface")|null | The mapped form or null | ### bool isPrefix(string $propertyPath) Matches a property path against a prefix of the rule path. #### Parameters | | | | | --- | --- | --- | | string | $propertyPath | The property path to match against the rule | #### Return Value | | | | --- | --- | | bool | Whether the property path is a prefix of the rule or not | ### [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") getTarget() #### Return Value | | | | --- | --- | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [ErrorMappingException](../../../exception/errormappingexception "Symfony\Component\Form\Exception\ErrorMappingException") | | symfony ViolationPathIterator ViolationPathIterator ====================== class **ViolationPathIterator** extends [PropertyPathIterator](../../../../propertyaccess/propertypathiterator "Symfony\Component\PropertyAccess\PropertyPathIterator") Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $path | | from [PropertyPathIterator](../../../../propertyaccess/propertypathiterator#property_path "Symfony\Component\PropertyAccess\PropertyPathIterator") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ViolationPath](violationpath "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath") $violationPath) | | | bool | [isIndex](#method_isIndex)() Returns whether the current element in the property path is an array index. | from [PropertyPathIterator](../../../../propertyaccess/propertypathiterator#method_isIndex "Symfony\Component\PropertyAccess\PropertyPathIterator") | | bool | [isProperty](#method_isProperty)() Returns whether the current element in the property path is a property name. | from [PropertyPathIterator](../../../../propertyaccess/propertypathiterator#method_isProperty "Symfony\Component\PropertyAccess\PropertyPathIterator") | | | [mapsForm](#method_mapsForm)() | | Details ------- ### \_\_construct([ViolationPath](violationpath "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath") $violationPath) #### Parameters | | | | | --- | --- | --- | | [ViolationPath](violationpath "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath") | $violationPath | | ### bool isIndex() Returns whether the current element in the property path is an array index. #### Return Value | | | | --- | --- | | bool | | ### bool isProperty() Returns whether the current element in the property path is a property name. #### Return Value | | | | --- | --- | | bool | | ### mapsForm()
programming_docs
symfony ViolationMapper ViolationMapper ================ class **ViolationMapper** implements [ViolationMapperInterface](violationmapperinterface "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface") Methods ------- | | | | | --- | --- | --- | | | [mapViolation](#method_mapViolation)([ConstraintViolation](../../../../validator/constraintviolation "Symfony\Component\Validator\ConstraintViolation") $violation, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, bool $allowNonSynchronized = false) Maps a constraint violation to a form in the form tree under the given form. | | Details ------- ### mapViolation([ConstraintViolation](../../../../validator/constraintviolation "Symfony\Component\Validator\ConstraintViolation") $violation, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, bool $allowNonSynchronized = false) Maps a constraint violation to a form in the form tree under the given form. #### Parameters | | | | | --- | --- | --- | | [ConstraintViolation](../../../../validator/constraintviolation "Symfony\Component\Validator\ConstraintViolation") | $violation | The violation to map | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | The root form of the tree to map it to | | bool | $allowNonSynchronized | Whether to allow mapping to non-synchronized forms | symfony Form Form ===== class **Form** extends [Constraint](../../../../validator/constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_SYNCHRONIZED\_ERROR | | | NO\_SUCH\_FIELD\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../../../../validator/constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../../../../validator/constraint#property_groups "Symfony\Component\Validator\Constraint") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../../../../validator/constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../../../../validator/constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../../../../validator/constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../../../../validator/constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../../../../validator/constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../../../../validator/constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../../../../validator/constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../../../../validator/constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../../../../validator/constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../../../../validator/constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../../validator/exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../../../../validator/exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../../../../validator/exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../../../../validator/exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../../../../validator/exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../../../../validator/exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony FormValidator FormValidator ============== class **FormValidator** extends [ConstraintValidator](../../../../validator/constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../../../../validator/context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../../../../validator/constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../../../../validator/context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../../../../validator/constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../../../../validator/constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../../../../validator/constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../../../../validator/constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)($form, [Constraint](../../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../../../../validator/context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../../../../validator/context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also ### validate($form, [Constraint](../../../../validator/constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | | $form | | | [Constraint](../../../../validator/constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony ServerParams ServerParams ============= class **ServerParams** extends [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([RequestStack](../../../../httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack = null) | from [ServerParams](../../../util/serverparams#method___construct "Symfony\Component\Form\Util\ServerParams") | | bool | [hasPostMaxSizeBeenExceeded](#method_hasPostMaxSizeBeenExceeded)() Returns true if the POST max size has been exceeded in the request. | from [ServerParams](../../../util/serverparams#method_hasPostMaxSizeBeenExceeded "Symfony\Component\Form\Util\ServerParams") | | int|null | [getPostMaxSize](#method_getPostMaxSize)() Returns maximum post size in bytes. | from [ServerParams](../../../util/serverparams#method_getPostMaxSize "Symfony\Component\Form\Util\ServerParams") | | string | [getNormalizedIniPostMaxSize](#method_getNormalizedIniPostMaxSize)() Returns the normalized "post\_max\_size" ini setting. | from [ServerParams](../../../util/serverparams#method_getNormalizedIniPostMaxSize "Symfony\Component\Form\Util\ServerParams") | | mixed | [getContentLength](#method_getContentLength)() Returns the content length of the request. | from [ServerParams](../../../util/serverparams#method_getContentLength "Symfony\Component\Form\Util\ServerParams") | Details ------- ### \_\_construct([RequestStack](../../../../httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack = null) #### Parameters | | | | | --- | --- | --- | | [RequestStack](../../../../httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") | $requestStack | | ### bool hasPostMaxSizeBeenExceeded() Returns true if the POST max size has been exceeded in the request. #### Return Value | | | | --- | --- | | bool | | ### int|null getPostMaxSize() Returns maximum post size in bytes. #### Return Value | | | | --- | --- | | int|null | The maximum post size in bytes | ### string getNormalizedIniPostMaxSize() Returns the normalized "post\_max\_size" ini setting. #### Return Value | | | | --- | --- | | string | | ### mixed getContentLength() Returns the content length of the request. #### Return Value | | | | --- | --- | | mixed | The request content length | symfony FormTypeValidatorExtension FormTypeValidatorExtension =========================== class **FormTypeValidatorExtension** extends [BaseValidatorExtension](basevalidatorextension "Symfony\Component\Form\Extension\Validator\Type\BaseValidatorExtension") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | | [\_\_construct](#method___construct)([ValidatorInterface](../../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator) | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### \_\_construct([ValidatorInterface](../../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator) #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](../../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended |
programming_docs
symfony BaseValidatorExtension BaseValidatorExtension ======================= abstract class **BaseValidatorExtension** extends [AbstractTypeExtension](../../../abstracttypeextension "Symfony\Component\Form\AbstractTypeExtension") Encapsulates common logic of {@link FormTypeValidatorExtension} and {@link SubmitTypeValidatorExtension}. Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildForm "Symfony\Component\Form\AbstractTypeExtension") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | symfony UploadValidatorExtension UploadValidatorExtension ========================= class **UploadValidatorExtension** extends [AbstractTypeExtension](../../../abstracttypeextension "Symfony\Component\Form\AbstractTypeExtension") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildForm "Symfony\Component\Form\AbstractTypeExtension") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | | [\_\_construct](#method___construct)([TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, string $translationDomain = null) | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### \_\_construct([TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, string $translationDomain = null) #### Parameters | | | | | --- | --- | --- | | [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | | | string | $translationDomain | | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended | symfony RepeatedTypeValidatorExtension RepeatedTypeValidatorExtension =============================== class **RepeatedTypeValidatorExtension** extends [AbstractTypeExtension](../../../abstracttypeextension "Symfony\Component\Form\AbstractTypeExtension") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildForm "Symfony\Component\Form\AbstractTypeExtension") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended | symfony SubmitTypeValidatorExtension SubmitTypeValidatorExtension ============================= class **SubmitTypeValidatorExtension** extends [BaseValidatorExtension](basevalidatorextension "Symfony\Component\Form\Extension\Validator\Type\BaseValidatorExtension") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildForm "Symfony\Component\Form\AbstractTypeExtension") | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [BaseValidatorExtension](basevalidatorextension#method_configureOptions "Symfony\Component\Form\Extension\Validator\Type\BaseValidatorExtension") | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended | symfony ValidationListener ValidationListener =================== class **ValidationListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Methods ------- | | | | | --- | --- | --- | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | | | [\_\_construct](#method___construct)([ValidatorInterface](../../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, [ViolationMapperInterface](../violationmapper/violationmapperinterface "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface") $violationMapper) | | | | [validateForm](#method_validateForm)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) Validates the form and its domain object. | | Details ------- ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | ### \_\_construct([ValidatorInterface](../../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, [ViolationMapperInterface](../violationmapper/violationmapperinterface "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface") $violationMapper) #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](../../../../validator/validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | | | [ViolationMapperInterface](../violationmapper/violationmapperinterface "Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface") | $violationMapper | | ### validateForm([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) Validates the form and its domain object. #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | The event object | symfony TemplatingExtension TemplatingExtension ==================== class **TemplatingExtension** extends [AbstractExtension](../../abstractextension "Symfony\Component\Form\AbstractExtension") Integrates the Templating component with the Form library. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | from [AbstractExtension](../../abstractextension#method_getType "Symfony\Component\Form\AbstractExtension") | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | from [AbstractExtension](../../abstractextension#method_hasType "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | from [AbstractExtension](../../abstractextension#method_getTypeExtensions "Symfony\Component\Form\AbstractExtension") | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | from [AbstractExtension](../../abstractextension#method_hasTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | from [AbstractExtension](../../abstractextension#method_getTypeGuesser "Symfony\Component\Form\AbstractExtension") | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | from [AbstractExtension](../../abstractextension#method_loadTypes "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | from [AbstractExtension](../../abstractextension#method_loadTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | from [AbstractExtension](../../abstractextension#method_loadTypeGuesser "Symfony\Component\Form\AbstractExtension") | | | [\_\_construct](#method___construct)([PhpEngine](../../../templating/phpengine "Symfony\Component\Templating\PhpEngine") $engine, [CsrfTokenManagerInterface](../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $csrfTokenManager = null, array $defaultThemes = array()) | | Details ------- ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### protected [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | ### \_\_construct([PhpEngine](../../../templating/phpengine "Symfony\Component\Templating\PhpEngine") $engine, [CsrfTokenManagerInterface](../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $csrfTokenManager = null, array $defaultThemes = array()) #### Parameters | | | | | --- | --- | --- | | [PhpEngine](../../../templating/phpengine "Symfony\Component\Templating\PhpEngine") | $engine | | | [CsrfTokenManagerInterface](../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") | $csrfTokenManager | | | array | $defaultThemes | |
programming_docs
symfony TemplatingRendererEngine TemplatingRendererEngine ========================= class **TemplatingRendererEngine** extends [AbstractRendererEngine](../../abstractrendererengine "Symfony\Component\Form\AbstractRendererEngine") Constants --------- | | | | --- | --- | | CACHE\_KEY\_VAR | *The variable in {@link FormView} used as cache key.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $defaultThemes | | from [AbstractRendererEngine](../../abstractrendererengine#property_defaultThemes "Symfony\Component\Form\AbstractRendererEngine") | | protected | $themes | | from [AbstractRendererEngine](../../abstractrendererengine#property_themes "Symfony\Component\Form\AbstractRendererEngine") | | protected | $useDefaultThemes | | from [AbstractRendererEngine](../../abstractrendererengine#property_useDefaultThemes "Symfony\Component\Form\AbstractRendererEngine") | | protected | $resources | | from [AbstractRendererEngine](../../abstractrendererengine#property_resources "Symfony\Component\Form\AbstractRendererEngine") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([EngineInterface](../../../templating/engineinterface "Symfony\Component\Templating\EngineInterface") $engine, array $defaultThemes = array()) Creates a new renderer engine. | | | | [setTheme](#method_setTheme)([FormView](../../formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. | from [AbstractRendererEngine](../../abstractrendererengine#method_setTheme "Symfony\Component\Form\AbstractRendererEngine") | | mixed | [getResourceForBlockName](#method_getResourceForBlockName)([FormView](../../formview "Symfony\Component\Form\FormView") $view, string $blockName) Returns the resource for a block name. | from [AbstractRendererEngine](../../abstractrendererengine#method_getResourceForBlockName "Symfony\Component\Form\AbstractRendererEngine") | | mixed | [getResourceForBlockNameHierarchy](#method_getResourceForBlockNameHierarchy)([FormView](../../formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the resource for a block hierarchy. | from [AbstractRendererEngine](../../abstractrendererengine#method_getResourceForBlockNameHierarchy "Symfony\Component\Form\AbstractRendererEngine") | | int|bool | [getResourceHierarchyLevel](#method_getResourceHierarchyLevel)([FormView](../../formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the hierarchy level at which a resource can be found. | from [AbstractRendererEngine](../../abstractrendererengine#method_getResourceHierarchyLevel "Symfony\Component\Form\AbstractRendererEngine") | | bool | [loadResourceForBlockName](#method_loadResourceForBlockName)(string $cacheKey, [FormView](../../formview "Symfony\Component\Form\FormView") $view, string $blockName) Loads the cache with the resource for a given block name. | | | string | [renderBlock](#method_renderBlock)([FormView](../../formview "Symfony\Component\Form\FormView") $view, mixed $resource, string $blockName, array $variables = array()) Renders a block in the given renderer resource. | | | bool | [loadResourceFromTheme](#method_loadResourceFromTheme)(string $cacheKey, string $blockName, mixed $theme) Tries to load the resource for a block from a theme. | | Details ------- ### \_\_construct([EngineInterface](../../../templating/engineinterface "Symfony\Component\Templating\EngineInterface") $engine, array $defaultThemes = array()) Creates a new renderer engine. #### Parameters | | | | | --- | --- | --- | | [EngineInterface](../../../templating/engineinterface "Symfony\Component\Templating\EngineInterface") | $engine | | | array | $defaultThemes | The default themes. The type of these themes is open to the implementation. | ### setTheme([FormView](../../formview "Symfony\Component\Form\FormView") $view, mixed $themes, bool $useDefaultThemes = true) Sets the theme(s) to be used for rendering a view and its children. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | The view to assign the theme(s) to | | mixed | $themes | The theme(s). The type of these themes is open to the implementation. | | bool | $useDefaultThemes | If true, will use default themes specified in the engine | ### mixed getResourceForBlockName([FormView](../../formview "Symfony\Component\Form\FormView") $view, string $blockName) Returns the resource for a block name. The resource is first searched in the themes attached to $view, then in the themes of its parent view and so on, until a resource was found. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | the view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc | | string | $blockName | The name of the block to render | #### Return Value | | | | --- | --- | | mixed | the renderer resource or false, if none was found | ### mixed getResourceForBlockNameHierarchy([FormView](../../formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the resource for a block hierarchy. A block hierarchy is an array which starts with the root of the hierarchy and continues with the child of that root, the child of that child etc. The following is an example for a block hierarchy: ``` form_widget text_widget url_widget ``` In this example, "url\_widget" is the most specific block, while the other blocks are its ancestors in the hierarchy. The second parameter $hierarchyLevel determines the level of the hierarchy that should be rendered. For example, if $hierarchyLevel is 2 for the above hierarchy, the engine will first look for the block "url\_widget", then, if that does not exist, for the block "text\_widget" etc. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | the view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc | | array | $blockNameHierarchy | The block name hierarchy, with the root block at the beginning | | int | $hierarchyLevel | The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy. | #### Return Value | | | | --- | --- | | mixed | The renderer resource or false, if none was found | ### int|bool getResourceHierarchyLevel([FormView](../../formview "Symfony\Component\Form\FormView") $view, array $blockNameHierarchy, int $hierarchyLevel) Returns the hierarchy level at which a resource can be found. A block hierarchy is an array which starts with the root of the hierarchy and continues with the child of that root, the child of that child etc. The following is an example for a block hierarchy: ``` form_widget text_widget url_widget ``` The second parameter $hierarchyLevel determines the level of the hierarchy that should be rendered. If we call this method with the hierarchy level 2, the engine will first look for a resource for block "url\_widget". If such a resource exists, the method returns 2. Otherwise it tries to find a resource for block "text\_widget" (at level 1) and, again, returns 1 if a resource was found. The method continues to look for resources until the root level was reached and nothing was found. In this case false is returned. The type of the resource is decided by the implementation. The resource is later passed to {@link renderBlock()} by the rendering algorithm. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | the view for determining the used themes. First the themes attached directly to the view with {@link setTheme()} are considered, then the ones of its parent etc | | array | $blockNameHierarchy | The block name hierarchy, with the root block at the beginning | | int | $hierarchyLevel | The level in the hierarchy at which to start looking. Level 0 indicates the root block, i.e. the first element of $blockNameHierarchy. | #### Return Value | | | | --- | --- | | int|bool | The hierarchy level or false, if no resource was found | ### protected bool loadResourceForBlockName(string $cacheKey, [FormView](../../formview "Symfony\Component\Form\FormView") $view, string $blockName) Loads the cache with the resource for a given block name. This implementation tries to load as few blocks as possible, since each block is represented by a template on the file system. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The cache key of the form view | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | The form view for finding the applying themes | | string | $blockName | The name of the block to load | #### Return Value | | | | --- | --- | | bool | True if the resource could be loaded, false otherwise | #### See also | | | | --- | --- | | getResourceForBlock() | | ### string renderBlock([FormView](../../formview "Symfony\Component\Form\FormView") $view, mixed $resource, string $blockName, array $variables = array()) Renders a block in the given renderer resource. The resource can be obtained by calling {@link getResourceForBlock()} or {@link getResourceForBlockHierarchy()}. The type of the resource is decided by the implementation. #### Parameters | | | | | --- | --- | --- | | [FormView](../../formview "Symfony\Component\Form\FormView") | $view | The view to render | | mixed | $resource | The renderer resource | | string | $blockName | The name of the block to render | | array | $variables | The variables to pass to the template | #### Return Value | | | | --- | --- | | string | The HTML markup | ### protected bool loadResourceFromTheme(string $cacheKey, string $blockName, mixed $theme) Tries to load the resource for a block from a theme. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The cache key for storing the resource | | string | $blockName | The name of the block to load a resource for | | mixed | $theme | The theme to load the block from | #### Return Value | | | | --- | --- | | bool | True if the resource could be loaded, false otherwise | symfony Symfony\Component\Form\Extension\Csrf\Type Symfony\Component\Form\Extension\Csrf\Type ========================================== Classes ------- | | | | --- | --- | | [FormTypeCsrfExtension](type/formtypecsrfextension "Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension") | | symfony Symfony\Component\Form\Extension\Csrf\EventListener Symfony\Component\Form\Extension\Csrf\EventListener =================================================== Classes ------- | | | | --- | --- | | [CsrfValidationListener](eventlistener/csrfvalidationlistener "Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener") | | symfony CsrfExtension CsrfExtension ============== class **CsrfExtension** extends [AbstractExtension](../../abstractextension "Symfony\Component\Form\AbstractExtension") This extension protects forms by using a CSRF token. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | from [AbstractExtension](../../abstractextension#method_getType "Symfony\Component\Form\AbstractExtension") | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | from [AbstractExtension](../../abstractextension#method_hasType "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | from [AbstractExtension](../../abstractextension#method_getTypeExtensions "Symfony\Component\Form\AbstractExtension") | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | from [AbstractExtension](../../abstractextension#method_hasTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | from [AbstractExtension](../../abstractextension#method_getTypeGuesser "Symfony\Component\Form\AbstractExtension") | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | from [AbstractExtension](../../abstractextension#method_loadTypes "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | from [AbstractExtension](../../abstractextension#method_loadTypeGuesser "Symfony\Component\Form\AbstractExtension") | | | [\_\_construct](#method___construct)([CsrfTokenManagerInterface](../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $tokenManager, [TranslatorInterface](../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator = null, string $translationDomain = null) | | Details ------- ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### protected [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | ### \_\_construct([CsrfTokenManagerInterface](../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $tokenManager, [TranslatorInterface](../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator = null, string $translationDomain = null) #### Parameters | | | | | --- | --- | --- | | [CsrfTokenManagerInterface](../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") | $tokenManager | The CSRF token manager | | [TranslatorInterface](../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | The translator for translating error messages | | string | $translationDomain | The translation domain for translating | symfony FormTypeCsrfExtension FormTypeCsrfExtension ====================== class **FormTypeCsrfExtension** extends [AbstractTypeExtension](../../../abstracttypeextension "Symfony\Component\Form\AbstractTypeExtension") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Adds a CSRF field to the form when the CSRF protection is enabled. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Adds a CSRF field to the root form view. | | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | | | | [\_\_construct](#method___construct)([CsrfTokenManagerInterface](../../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '\_token', [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator = null, string $translationDomain = null, [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") $serverParams = null) | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Adds a CSRF field to the form when the CSRF protection is enabled. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Adds a CSRF field to the root form view. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### \_\_construct([CsrfTokenManagerInterface](../../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '\_token', [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator = null, string $translationDomain = null, [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") $serverParams = null) #### Parameters | | | | | --- | --- | --- | | [CsrfTokenManagerInterface](../../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") | $defaultTokenManager | | | bool | $defaultEnabled | | | string | $defaultFieldName | | | [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | | | string | $translationDomain | | | [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") | $serverParams | | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended |
programming_docs
symfony CsrfValidationListener CsrfValidationListener ======================= class **CsrfValidationListener** implements [EventSubscriberInterface](../../../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") Methods ------- | | | | | --- | --- | --- | | static array | [getSubscribedEvents](#method_getSubscribedEvents)() Returns an array of event names this subscriber wants to listen to. | | | | [\_\_construct](#method___construct)(string $fieldName, [CsrfTokenManagerInterface](../../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $tokenManager, string $tokenId, string $errorMessage, [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator = null, string $translationDomain = null, [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") $serverParams = null) | | | | [preSubmit](#method_preSubmit)([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) | | Details ------- ### static array getSubscribedEvents() Returns an array of event names this subscriber wants to listen to. The array keys are event names and the value can be: * The method name to call (priority defaults to 0) * An array composed of the method name to call and the priority * An array of arrays composed of the method names to call and respective priorities, or 0 if unset For instance: * array('eventName' => 'methodName') * array('eventName' => array('methodName', $priority)) * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) #### Return Value | | | | --- | --- | | array | The event names to listen to | ### \_\_construct(string $fieldName, [CsrfTokenManagerInterface](../../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") $tokenManager, string $tokenId, string $errorMessage, [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator = null, string $translationDomain = null, [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") $serverParams = null) #### Parameters | | | | | --- | --- | --- | | string | $fieldName | | | [CsrfTokenManagerInterface](../../../../security/csrf/csrftokenmanagerinterface "Symfony\Component\Security\Csrf\CsrfTokenManagerInterface") | $tokenManager | | | string | $tokenId | | | string | $errorMessage | | | [TranslatorInterface](../../../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | | | string | $translationDomain | | | [ServerParams](../../../util/serverparams "Symfony\Component\Form\Util\ServerParams") | $serverParams | | ### preSubmit([FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") $event) #### Parameters | | | | | --- | --- | --- | | [FormEvent](../../../formevent "Symfony\Component\Form\FormEvent") | $event | | symfony DependencyInjectionExtension DependencyInjectionExtension ============================= class **DependencyInjectionExtension** implements [FormExtensionInterface](../../formextensioninterface "Symfony\Component\Form\FormExtensionInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(ContainerInterface $typeContainer, array $typeExtensionServices, iterable $guesserServices) | | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | | Details ------- ### \_\_construct(ContainerInterface $typeContainer, array $typeExtensionServices, iterable $guesserServices) #### Parameters | | | | | --- | --- | --- | | ContainerInterface | $typeContainer | | | array | $typeExtensionServices | | | iterable | $guesserServices | | ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | symfony Symfony\Component\Form\Extension\HttpFoundation\Type Symfony\Component\Form\Extension\HttpFoundation\Type ==================================================== Classes ------- | | | | --- | --- | | [FormTypeHttpFoundationExtension](type/formtypehttpfoundationextension "Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension") | | symfony HttpFoundationExtension HttpFoundationExtension ======================== class **HttpFoundationExtension** extends [AbstractExtension](../../abstractextension "Symfony\Component\Form\AbstractExtension") Integrates the HttpFoundation component with the Form library. Methods ------- | | | | | --- | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | [getType](#method_getType)(string $name) Returns a type by name. | from [AbstractExtension](../../abstractextension#method_getType "Symfony\Component\Form\AbstractExtension") | | bool | [hasType](#method_hasType)(string $name) Returns whether the given type is supported. | from [AbstractExtension](../../abstractextension#method_hasType "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [getTypeExtensions](#method_getTypeExtensions)(string $name) Returns the extensions for the given type. | from [AbstractExtension](../../abstractextension#method_getTypeExtensions "Symfony\Component\Form\AbstractExtension") | | bool | [hasTypeExtensions](#method_hasTypeExtensions)(string $name) Returns whether this extension provides type extensions for the given type. | from [AbstractExtension](../../abstractextension#method_hasTypeExtensions "Symfony\Component\Form\AbstractExtension") | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [getTypeGuesser](#method_getTypeGuesser)() Returns the type guesser provided by this extension. | from [AbstractExtension](../../abstractextension#method_getTypeGuesser "Symfony\Component\Form\AbstractExtension") | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | [loadTypes](#method_loadTypes)() Registers the types. | from [AbstractExtension](../../abstractextension#method_loadTypes "Symfony\Component\Form\AbstractExtension") | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | [loadTypeExtensions](#method_loadTypeExtensions)() Registers the type extensions. | | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | [loadTypeGuesser](#method_loadTypeGuesser)() Registers the type guesser. | from [AbstractExtension](../../abstractextension#method_loadTypeGuesser "Symfony\Component\Form\AbstractExtension") | Details ------- ### [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") getType(string $name) Returns a type by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface") | The type | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given type is not supported by this extension | ### bool hasType(string $name) Returns whether the given type is supported. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the type is supported by this extension | ### [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] getTypeExtensions(string $name) Returns the extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of extensions as FormTypeExtensionInterface instances | ### bool hasTypeExtensions(string $name) Returns whether this extension provides type extensions for the given type. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the type | #### Return Value | | | | --- | --- | | bool | Whether the given type has extensions | ### [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null getTypeGuesser() Returns the type guesser provided by this extension. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | The type guesser | ### protected [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] loadTypes() Registers the types. #### Return Value | | | | --- | --- | | [FormTypeInterface](../../formtypeinterface "Symfony\Component\Form\FormTypeInterface")[] | An array of FormTypeInterface instances | ### protected [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] loadTypeExtensions() Registers the type extensions. #### Return Value | | | | --- | --- | | [FormTypeExtensionInterface](../../formtypeextensioninterface "Symfony\Component\Form\FormTypeExtensionInterface")[] | An array of FormTypeExtensionInterface instances | ### protected [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null loadTypeGuesser() Registers the type guesser. #### Return Value | | | | --- | --- | | [FormTypeGuesserInterface](../../formtypeguesserinterface "Symfony\Component\Form\FormTypeGuesserInterface")|null | A type guesser | symfony HttpFoundationRequestHandler HttpFoundationRequestHandler ============================= class **HttpFoundationRequestHandler** implements [RequestHandlerInterface](../../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") A request processor using the {@link Request} class of the HttpFoundation component. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ServerParams](../../util/serverparams "Symfony\Component\Form\Util\ServerParams") $serverParams = null) | | | | [handleRequest](#method_handleRequest)([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, mixed $request = null) Submits a form if it was submitted. | | | bool | [isFileUpload](#method_isFileUpload)(mixed $data) Returns true if the given data is a file upload. | | Details ------- ### \_\_construct([ServerParams](../../util/serverparams "Symfony\Component\Form\Util\ServerParams") $serverParams = null) #### Parameters | | | | | --- | --- | --- | | [ServerParams](../../util/serverparams "Symfony\Component\Form\Util\ServerParams") | $serverParams | | ### handleRequest([FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") $form, mixed $request = null) Submits a form if it was submitted. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../../forminterface "Symfony\Component\Form\FormInterface") | $form | The form to submit | | mixed | $request | The current request | ### bool isFileUpload(mixed $data) Returns true if the given data is a file upload. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The form field data | #### Return Value | | | | --- | --- | | bool | | symfony FormTypeHttpFoundationExtension FormTypeHttpFoundationExtension ================================ class **FormTypeHttpFoundationExtension** extends [AbstractTypeExtension](../../../abstracttypeextension "Symfony\Component\Form\AbstractTypeExtension") Methods ------- | | | | | --- | --- | --- | | | [buildForm](#method_buildForm)([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. | | | | [buildView](#method_buildView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_buildView "Symfony\Component\Form\AbstractTypeExtension") | | | [finishView](#method_finishView)([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. | from [AbstractTypeExtension](../../../abstracttypeextension#method_finishView "Symfony\Component\Form\AbstractTypeExtension") | | | [configureOptions](#method_configureOptions)([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. | from [AbstractTypeExtension](../../../abstracttypeextension#method_configureOptions "Symfony\Component\Form\AbstractTypeExtension") | | | [\_\_construct](#method___construct)([RequestHandlerInterface](../../../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler = null) | | | string | [getExtendedType](#method_getExtendedType)() Returns the name of the type being extended. | | Details ------- ### buildForm([FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $builder, array $options) Builds the form. This method is called after the extended type has built the form to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormBuilderInterface](../../../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $builder | | | array | $options | | ### buildView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Builds the view. This method is called after the extended type has built the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### finishView([FormView](../../../formview "Symfony\Component\Form\FormView") $view, [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") $form, array $options) Finishes the view. This method is called after the extended type has finished the view to further modify it. #### Parameters | | | | | --- | --- | --- | | [FormView](../../../formview "Symfony\Component\Form\FormView") | $view | | | [FormInterface](../../../forminterface "Symfony\Component\Form\FormInterface") | $form | | | array | $options | | ### configureOptions([OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $resolver) Configures the options for this type. #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $resolver | The resolver for the options | ### \_\_construct([RequestHandlerInterface](../../../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler = null) #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](../../../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | ### string getExtendedType() Returns the name of the type being extended. #### Return Value | | | | --- | --- | | string | The name of the type being extended | symfony FormBuilderInterface FormBuilderInterface ===================== interface **FormBuilderInterface** implements [Iterator](http://php.net/Iterator), [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") Methods ------- | | | | | --- | --- | --- | | [EventDispatcherInterface](../../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | [getEventDispatcher](#method_getEventDispatcher)() Returns the event dispatcher used to dispatch form events. | from [FormConfigInterface](../formconfiginterface#method_getEventDispatcher "Symfony\Component\Form\FormConfigInterface") | | string | [getName](#method_getName)() Returns the name of the form used as HTTP parameter. | from [FormConfigInterface](../formconfiginterface#method_getName "Symfony\Component\Form\FormConfigInterface") | | [PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form should be mapped to. | from [FormConfigInterface](../formconfiginterface#method_getPropertyPath "Symfony\Component\Form\FormConfigInterface") | | bool | [getMapped](#method_getMapped)() Returns whether the form should be mapped to an element of its parent's data. | from [FormConfigInterface](../formconfiginterface#method_getMapped "Symfony\Component\Form\FormConfigInterface") | | bool | [getByReference](#method_getByReference)() Returns whether the form's data should be modified by reference. | from [FormConfigInterface](../formconfiginterface#method_getByReference "Symfony\Component\Form\FormConfigInterface") | | bool | [getInheritData](#method_getInheritData)() Returns whether the form should read and write the data of its parent. | from [FormConfigInterface](../formconfiginterface#method_getInheritData "Symfony\Component\Form\FormConfigInterface") | | bool | [getCompound](#method_getCompound)() Returns whether the form is compound. | from [FormConfigInterface](../formconfiginterface#method_getCompound "Symfony\Component\Form\FormConfigInterface") | | [ResolvedFormTypeInterface](../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | [getType](#method_getType)() Returns the form types used to construct the form. | from [FormConfigInterface](../formconfiginterface#method_getType "Symfony\Component\Form\FormConfigInterface") | | [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getViewTransformers](#method_getViewTransformers)() Returns the view transformers of the form. | from [FormConfigInterface](../formconfiginterface#method_getViewTransformers "Symfony\Component\Form\FormConfigInterface") | | [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | [getModelTransformers](#method_getModelTransformers)() Returns the model transformers of the form. | from [FormConfigInterface](../formconfiginterface#method_getModelTransformers "Symfony\Component\Form\FormConfigInterface") | | [DataMapperInterface](../datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | [getDataMapper](#method_getDataMapper)() Returns the data mapper of the form. | from [FormConfigInterface](../formconfiginterface#method_getDataMapper "Symfony\Component\Form\FormConfigInterface") | | bool | [getRequired](#method_getRequired)() Returns whether the form is required. | from [FormConfigInterface](../formconfiginterface#method_getRequired "Symfony\Component\Form\FormConfigInterface") | | bool | [getDisabled](#method_getDisabled)() Returns whether the form is disabled. | from [FormConfigInterface](../formconfiginterface#method_getDisabled "Symfony\Component\Form\FormConfigInterface") | | bool | [getErrorBubbling](#method_getErrorBubbling)() Returns whether errors attached to the form will bubble to its parent. | from [FormConfigInterface](../formconfiginterface#method_getErrorBubbling "Symfony\Component\Form\FormConfigInterface") | | mixed | [getEmptyData](#method_getEmptyData)() Returns the data that should be returned when the form is empty. | from [FormConfigInterface](../formconfiginterface#method_getEmptyData "Symfony\Component\Form\FormConfigInterface") | | array | [getAttributes](#method_getAttributes)() Returns additional attributes of the form. | from [FormConfigInterface](../formconfiginterface#method_getAttributes "Symfony\Component\Form\FormConfigInterface") | | bool | [hasAttribute](#method_hasAttribute)(string $name) Returns whether the attribute with the given name exists. | from [FormConfigInterface](../formconfiginterface#method_hasAttribute "Symfony\Component\Form\FormConfigInterface") | | mixed | [getAttribute](#method_getAttribute)(string $name, mixed $default = null) Returns the value of the given attribute. | from [FormConfigInterface](../formconfiginterface#method_getAttribute "Symfony\Component\Form\FormConfigInterface") | | mixed | [getData](#method_getData)() Returns the initial data of the form. | from [FormConfigInterface](../formconfiginterface#method_getData "Symfony\Component\Form\FormConfigInterface") | | string|null | [getDataClass](#method_getDataClass)() Returns the class of the form data or null if the data is scalar or an array. | from [FormConfigInterface](../formconfiginterface#method_getDataClass "Symfony\Component\Form\FormConfigInterface") | | bool | [getDataLocked](#method_getDataLocked)() Returns whether the form's data is locked. | from [FormConfigInterface](../formconfiginterface#method_getDataLocked "Symfony\Component\Form\FormConfigInterface") | | [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | [getFormFactory](#method_getFormFactory)() Returns the form factory used for creating new forms. | from [FormConfigInterface](../formconfiginterface#method_getFormFactory "Symfony\Component\Form\FormConfigInterface") | | string | [getAction](#method_getAction)() Returns the target URL of the form. | from [FormConfigInterface](../formconfiginterface#method_getAction "Symfony\Component\Form\FormConfigInterface") | | string | [getMethod](#method_getMethod)() Returns the HTTP method used by the form. | from [FormConfigInterface](../formconfiginterface#method_getMethod "Symfony\Component\Form\FormConfigInterface") | | [RequestHandlerInterface](../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | [getRequestHandler](#method_getRequestHandler)() Returns the request handler used by the form. | from [FormConfigInterface](../formconfiginterface#method_getRequestHandler "Symfony\Component\Form\FormConfigInterface") | | bool | [getAutoInitialize](#method_getAutoInitialize)() Returns whether the form should be initialized upon creation. | from [FormConfigInterface](../formconfiginterface#method_getAutoInitialize "Symfony\Component\Form\FormConfigInterface") | | array | [getOptions](#method_getOptions)() Returns all options passed during the construction of the form. | from [FormConfigInterface](../formconfiginterface#method_getOptions "Symfony\Component\Form\FormConfigInterface") | | bool | [hasOption](#method_hasOption)(string $name) Returns whether a specific option exists. | from [FormConfigInterface](../formconfiginterface#method_hasOption "Symfony\Component\Form\FormConfigInterface") | | mixed | [getOption](#method_getOption)(string $name, mixed $default = null) Returns the value of a specific option. | from [FormConfigInterface](../formconfiginterface#method_getOption "Symfony\Component\Form\FormConfigInterface") | | $this | [addEventListener](#method_addEventListener)(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_addEventListener "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [addEventSubscriber](#method_addEventSubscriber)([EventSubscriberInterface](../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_addEventSubscriber "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [addViewTransformer](#method_addViewTransformer)([DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_addViewTransformer "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [resetViewTransformers](#method_resetViewTransformers)() Clears the view transformers. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_resetViewTransformers "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [addModelTransformer](#method_addModelTransformer)([DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_addModelTransformer "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [resetModelTransformers](#method_resetModelTransformers)() Clears the normalization transformers. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_resetModelTransformers "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setAttribute](#method_setAttribute)(string $name, mixed $value) Sets the value for an attribute. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setAttribute "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setAttributes](#method_setAttributes)(array $attributes) Sets the attributes. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setAttributes "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setDataMapper](#method_setDataMapper)([DataMapperInterface](../datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setDataMapper "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setDisabled](#method_setDisabled)(bool $disabled) Set whether the form is disabled. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setDisabled "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setEmptyData](#method_setEmptyData)(mixed $emptyData) Sets the data used for the client data when no value is submitted. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setEmptyData "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setErrorBubbling](#method_setErrorBubbling)(bool $errorBubbling) Sets whether errors bubble up to the parent. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setErrorBubbling "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setRequired](#method_setRequired)(bool $required) Sets whether this field is required to be filled out when submitted. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setRequired "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setPropertyPath](#method_setPropertyPath)(string|[PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setPropertyPath "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setMapped](#method_setMapped)(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setMapped "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setByReference](#method_setByReference)(bool $byReference) Sets whether the form's data should be modified by reference. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setByReference "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setInheritData](#method_setInheritData)(bool $inheritData) Sets whether the form should read and write the data of its parent. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setInheritData "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setCompound](#method_setCompound)(bool $compound) Sets whether the form should be compound. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setCompound "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setType](#method_setType)([ResolvedFormTypeInterface](../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setType "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setData](#method_setData)(mixed $data) Sets the initial data of the form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setData "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setDataLocked](#method_setDataLocked)(bool $locked) Locks the form's data to the data passed in the configuration. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setDataLocked "Symfony\Component\Form\FormConfigBuilderInterface") | | | [setFormFactory](#method_setFormFactory)([FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setFormFactory "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setAction](#method_setAction)(string $action) Sets the target URL of the form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setAction "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setMethod](#method_setMethod)(string $method) Sets the HTTP method used by the form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setMethod "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setRequestHandler](#method_setRequestHandler)([RequestHandlerInterface](../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setRequestHandler "Symfony\Component\Form\FormConfigBuilderInterface") | | $this | [setAutoInitialize](#method_setAutoInitialize)(bool $initialize) Sets whether the form should be initialized automatically. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_setAutoInitialize "Symfony\Component\Form\FormConfigBuilderInterface") | | [FormConfigInterface](../formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getFormConfig](#method_getFormConfig)() Builds and returns the form configuration. | from [FormConfigBuilderInterface](../formconfigbuilderinterface#method_getFormConfig "Symfony\Component\Form\FormConfigBuilderInterface") | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [add](#method_add)(string|int|[FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten. | from [FormBuilderInterface](../formbuilderinterface#method_add "Symfony\Component\Form\FormBuilderInterface") | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [create](#method_create)(string $name, string|null $type = null, array $options = array()) Creates a form builder. | from [FormBuilderInterface](../formbuilderinterface#method_create "Symfony\Component\Form\FormBuilderInterface") | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [get](#method_get)(string $name) Returns a child by name. | from [FormBuilderInterface](../formbuilderinterface#method_get "Symfony\Component\Form\FormBuilderInterface") | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | [remove](#method_remove)(string $name) Removes the field with the given name. | from [FormBuilderInterface](../formbuilderinterface#method_remove "Symfony\Component\Form\FormBuilderInterface") | | bool | [has](#method_has)(string $name) Returns whether a field with the given name exists. | from [FormBuilderInterface](../formbuilderinterface#method_has "Symfony\Component\Form\FormBuilderInterface") | | array | [all](#method_all)() Returns the children. | from [FormBuilderInterface](../formbuilderinterface#method_all "Symfony\Component\Form\FormBuilderInterface") | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | [getForm](#method_getForm)() Creates the form. | from [FormBuilderInterface](../formbuilderinterface#method_getForm "Symfony\Component\Form\FormBuilderInterface") | Details ------- ### [EventDispatcherInterface](../../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") getEventDispatcher() Returns the event dispatcher used to dispatch form events. #### Return Value | | | | --- | --- | | [EventDispatcherInterface](../../eventdispatcher/eventdispatcherinterface "Symfony\Component\EventDispatcher\EventDispatcherInterface") | The dispatcher | ### string getName() Returns the name of the form used as HTTP parameter. #### Return Value | | | | --- | --- | | string | The form name | ### [PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form should be mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### bool getMapped() Returns whether the form should be mapped to an element of its parent's data. #### Return Value | | | | --- | --- | | bool | Whether the form is mapped | ### bool getByReference() Returns whether the form's data should be modified by reference. #### Return Value | | | | --- | --- | | bool | Whether to modify the form's data by reference | ### bool getInheritData() Returns whether the form should read and write the data of its parent. #### Return Value | | | | --- | --- | | bool | Whether the form should inherit its parent's data | ### bool getCompound() Returns whether the form is compound. This property is independent of whether the form actually has children. A form can be compound and have no children at all, like for example an empty collection form. #### Return Value | | | | --- | --- | | bool | Whether the form is compound | ### [ResolvedFormTypeInterface](../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") getType() Returns the form types used to construct the form. #### Return Value | | | | --- | --- | | [ResolvedFormTypeInterface](../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | The form's type | ### [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getViewTransformers() Returns the view transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] getModelTransformers() Returns the model transformers of the form. #### Return Value | | | | --- | --- | | [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface")[] | An array of {@link DataTransformerInterface} instances | ### [DataMapperInterface](../datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null getDataMapper() Returns the data mapper of the form. #### Return Value | | | | --- | --- | | [DataMapperInterface](../datamapperinterface "Symfony\Component\Form\DataMapperInterface")|null | The data mapper | ### bool getRequired() Returns whether the form is required. #### Return Value | | | | --- | --- | | bool | Whether the form is required | ### bool getDisabled() Returns whether the form is disabled. #### Return Value | | | | --- | --- | | bool | Whether the form is disabled | ### bool getErrorBubbling() Returns whether errors attached to the form will bubble to its parent. #### Return Value | | | | --- | --- | | bool | Whether errors will bubble up | ### mixed getEmptyData() Returns the data that should be returned when the form is empty. #### Return Value | | | | --- | --- | | mixed | The data returned if the form is empty | ### array getAttributes() Returns additional attributes of the form. #### Return Value | | | | --- | --- | | array | An array of key-value combinations | ### bool hasAttribute(string $name) Returns whether the attribute with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | #### Return Value | | | | --- | --- | | bool | Whether the attribute exists | ### mixed getAttribute(string $name, mixed $default = null) Returns the value of the given attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The attribute name | | mixed | $default | The value returned if the attribute does not exist | #### Return Value | | | | --- | --- | | mixed | The attribute value | ### mixed getData() Returns the initial data of the form. #### Return Value | | | | --- | --- | | mixed | The initial form data | ### string|null getDataClass() Returns the class of the form data or null if the data is scalar or an array. #### Return Value | | | | --- | --- | | string|null | The data class or null | ### bool getDataLocked() Returns whether the form's data is locked. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Return Value | | | | --- | --- | | bool | Whether the data is locked | ### [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") getFormFactory() Returns the form factory used for creating new forms. #### Return Value | | | | --- | --- | | [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | The form factory | ### string getAction() Returns the target URL of the form. #### Return Value | | | | --- | --- | | string | The target URL of the form | ### string getMethod() Returns the HTTP method used by the form. #### Return Value | | | | --- | --- | | string | The HTTP method of the form | ### [RequestHandlerInterface](../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") getRequestHandler() Returns the request handler used by the form. #### Return Value | | | | --- | --- | | [RequestHandlerInterface](../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | The request handler | ### bool getAutoInitialize() Returns whether the form should be initialized upon creation. #### Return Value | | | | --- | --- | | bool | returns true if the form should be initialized when created, false otherwise | ### array getOptions() Returns all options passed during the construction of the form. #### Return Value | | | | --- | --- | | array | The passed options | ### bool hasOption(string $name) Returns whether a specific option exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name, | #### Return Value | | | | --- | --- | | bool | Whether the option exists | ### mixed getOption(string $name, mixed $default = null) Returns the value of a specific option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | mixed | $default | The value returned if the option does not exist | #### Return Value | | | | --- | --- | | mixed | The option value | ### $this addEventListener(string $eventName, callable $listener, int $priority = 0) Adds an event listener to an event on this form. #### Parameters | | | | | --- | --- | --- | | string | $eventName | The name of the event to listen to | | callable | $listener | The listener to execute | | int | $priority | The priority of the listener. Listeners with a higher priority are called before listeners with a lower priority. | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addEventSubscriber([EventSubscriberInterface](../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") $subscriber) Adds an event subscriber for events on this form. #### Parameters | | | | | --- | --- | --- | | [EventSubscriberInterface](../../eventdispatcher/eventsubscriberinterface "Symfony\Component\EventDispatcher\EventSubscriberInterface") | $subscriber | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addViewTransformer([DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $viewTransformer, bool $forcePrepend = false) Appends / prepends a transformer to the view transformer chain. The transform method of the transformer is used to convert data from the normalized to the view format. The reverseTransform method of the transformer is used to convert from the view to the normalized format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $viewTransformer | | | bool | $forcePrepend | If set to true, prepend instead of appending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetViewTransformers() Clears the view transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this addModelTransformer([DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") $modelTransformer, bool $forceAppend = false) Prepends / appends a transformer to the normalization transformer chain. The transform method of the transformer is used to convert data from the model to the normalized format. The reverseTransform method of the transformer is used to convert from the normalized to the model format. #### Parameters | | | | | --- | --- | --- | | [DataTransformerInterface](../datatransformerinterface "Symfony\Component\Form\DataTransformerInterface") | $modelTransformer | | | bool | $forceAppend | If set to true, append instead of prepending | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this resetModelTransformers() Clears the normalization transformers. #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttribute(string $name, mixed $value) Sets the value for an attribute. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the attribute | | mixed | $value | The value of the attribute | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAttributes(array $attributes) Sets the attributes. #### Parameters | | | | | --- | --- | --- | | array | $attributes | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataMapper([DataMapperInterface](../datamapperinterface "Symfony\Component\Form\DataMapperInterface") $dataMapper = null) Sets the data mapper used by the form. #### Parameters | | | | | --- | --- | --- | | [DataMapperInterface](../datamapperinterface "Symfony\Component\Form\DataMapperInterface") | $dataMapper | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDisabled(bool $disabled) Set whether the form is disabled. #### Parameters | | | | | --- | --- | --- | | bool | $disabled | Whether the form is disabled | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setEmptyData(mixed $emptyData) Sets the data used for the client data when no value is submitted. #### Parameters | | | | | --- | --- | --- | | mixed | $emptyData | The empty data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setErrorBubbling(bool $errorBubbling) Sets whether errors bubble up to the parent. #### Parameters | | | | | --- | --- | --- | | bool | $errorBubbling | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequired(bool $required) Sets whether this field is required to be filled out when submitted. #### Parameters | | | | | --- | --- | --- | | bool | $required | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setPropertyPath(string|[PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null $propertyPath) Sets the property path that the form should be mapped to. #### Parameters | | | | | --- | --- | --- | | string|[PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | $propertyPath | The property path or null if the path should be set automatically based on the form's name | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMapped(bool $mapped) Sets whether the form should be mapped to an element of its parent's data. #### Parameters | | | | | --- | --- | --- | | bool | $mapped | Whether the form should be mapped | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setByReference(bool $byReference) Sets whether the form's data should be modified by reference. #### Parameters | | | | | --- | --- | --- | | bool | $byReference | Whether the data should be modified by reference | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setInheritData(bool $inheritData) Sets whether the form should read and write the data of its parent. #### Parameters | | | | | --- | --- | --- | | bool | $inheritData | Whether the form should inherit its parent's data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setCompound(bool $compound) Sets whether the form should be compound. #### Parameters | | | | | --- | --- | --- | | bool | $compound | Whether the form should be compound | #### Return Value | | | | --- | --- | | $this | The configuration object | #### See also | | | | --- | --- | | [FormConfigInterface::getCompound](../formconfiginterface#method_getCompound "Symfony\Component\Form\FormConfigInterface") | | ### $this setType([ResolvedFormTypeInterface](../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) Set the types. #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setData(mixed $data) Sets the initial data of the form. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The data of the form in application format | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setDataLocked(bool $locked) Locks the form's data to the data passed in the configuration. A form with locked data is restricted to the data passed in this configuration. The data can only be modified then by submitting the form. #### Parameters | | | | | --- | --- | --- | | bool | $locked | Whether to lock the default data | #### Return Value | | | | --- | --- | | $this | The configuration object | ### setFormFactory([FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") $formFactory) Sets the form factory used for creating new forms. #### Parameters | | | | | --- | --- | --- | | [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $formFactory | | ### $this setAction(string $action) Sets the target URL of the form. #### Parameters | | | | | --- | --- | --- | | string | $action | The target URL of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setMethod(string $method) Sets the HTTP method used by the form. #### Parameters | | | | | --- | --- | --- | | string | $method | The HTTP method of the form | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setRequestHandler([RequestHandlerInterface](../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") $requestHandler) Sets the request handler used by the form. #### Parameters | | | | | --- | --- | --- | | [RequestHandlerInterface](../requesthandlerinterface "Symfony\Component\Form\RequestHandlerInterface") | $requestHandler | | #### Return Value | | | | --- | --- | | $this | The configuration object | ### $this setAutoInitialize(bool $initialize) Sets whether the form should be initialized automatically. Should be set to true only for root forms. #### Parameters | | | | | --- | --- | --- | | bool | $initialize | true to initialize the form automatically, false to suppress automatic initialization. In the second case, you need to call {@link FormInterface::initialize()} manually | #### Return Value | | | | --- | --- | | $this | The configuration object | ### [FormConfigInterface](../formconfiginterface "Symfony\Component\Form\FormConfigInterface") getFormConfig() Builds and returns the form configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](../formconfiginterface "Symfony\Component\Form\FormConfigInterface") | | ### [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") add(string|int|[FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") $child, string|null $type = null, array $options = array()) Adds a new field to this group. A field must have a unique name within the group. Otherwise the existing field is overwritten. If you add a nested group, this group should also be represented in the object hierarchy. #### Parameters | | | | | --- | --- | --- | | string|int|[FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | $child | | | string|null | $type | | | array | $options | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | ### [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") create(string $name, string|null $type = null, array $options = array()) Creates a form builder. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the form or the name of the property | | string|null | $type | The type of the form or null if name is a property | | array | $options | The options | #### Return Value | | | | --- | --- | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | ### [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") get(string $name) Returns a child by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given child does not exist | ### [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") remove(string $name) Removes the field with the given name. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | [FormBuilderInterface](../formbuilderinterface "Symfony\Component\Form\FormBuilderInterface") | | ### bool has(string $name) Returns whether a field with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | bool | | ### array all() Returns the children. #### Return Value | | | | --- | --- | | array | | ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") getForm() Creates the form. #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | The form |
programming_docs
symfony FormIntegrationTestCase FormIntegrationTestCase ======================== abstract class **FormIntegrationTestCase** extends TestCase Properties ---------- | | | | | | --- | --- | --- | --- | | protected [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | | | Methods ------- | | | | | --- | --- | --- | | | [setUp](#method_setUp)() | | | | [getExtensions](#method_getExtensions)() | | | | [getTypeExtensions](#method_getTypeExtensions)() | | | | [getTypes](#method_getTypes)() | | | | [getTypeGuessers](#method_getTypeGuessers)() | | Details ------- ### protected setUp() ### protected getExtensions() ### protected getTypeExtensions() ### protected getTypes() ### protected getTypeGuessers() symfony FormInterface FormInterface ============== interface **FormInterface** implements [Iterator](http://php.net/Iterator), [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") Methods ------- | | | | | --- | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | [setParent](#method_setParent)([FormInterface](../forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. | from [FormInterface](../forminterface#method_setParent "Symfony\Component\Form\FormInterface") | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")|null | [getParent](#method_getParent)() Returns the parent form. | from [FormInterface](../forminterface#method_getParent "Symfony\Component\Form\FormInterface") | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | [add](#method_add)([FormInterface](../forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Adds or replaces a child to the form. | from [FormInterface](../forminterface#method_add "Symfony\Component\Form\FormInterface") | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | [get](#method_get)(string $name) Returns the child with the given name. | from [FormInterface](../forminterface#method_get "Symfony\Component\Form\FormInterface") | | bool | [has](#method_has)(string $name) Returns whether a child with the given name exists. | from [FormInterface](../forminterface#method_has "Symfony\Component\Form\FormInterface") | | $this | [remove](#method_remove)(string $name) Removes a child from the form. | from [FormInterface](../forminterface#method_remove "Symfony\Component\Form\FormInterface") | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")[] | [all](#method_all)() Returns all children in this group. | from [FormInterface](../forminterface#method_all "Symfony\Component\Form\FormInterface") | | [FormErrorIterator](../formerroriterator "Symfony\Component\Form\FormErrorIterator") | [getErrors](#method_getErrors)(bool $deep = false, bool $flatten = true) Returns the errors of this form. | from [FormInterface](../forminterface#method_getErrors "Symfony\Component\Form\FormInterface") | | $this | [setData](#method_setData)(mixed $modelData) Updates the form with default data. | from [FormInterface](../forminterface#method_setData "Symfony\Component\Form\FormInterface") | | mixed | [getData](#method_getData)() Returns the data in the format needed for the underlying object. | from [FormInterface](../forminterface#method_getData "Symfony\Component\Form\FormInterface") | | mixed | [getNormData](#method_getNormData)() Returns the normalized data of the field. | from [FormInterface](../forminterface#method_getNormData "Symfony\Component\Form\FormInterface") | | mixed | [getViewData](#method_getViewData)() Returns the data transformed by the value transformer. | from [FormInterface](../forminterface#method_getViewData "Symfony\Component\Form\FormInterface") | | array | [getExtraData](#method_getExtraData)() Returns the extra data. | from [FormInterface](../forminterface#method_getExtraData "Symfony\Component\Form\FormInterface") | | [FormConfigInterface](../formconfiginterface "Symfony\Component\Form\FormConfigInterface") | [getConfig](#method_getConfig)() Returns the form's configuration. | from [FormInterface](../forminterface#method_getConfig "Symfony\Component\Form\FormInterface") | | bool | [isSubmitted](#method_isSubmitted)() Returns whether the form is submitted. | from [FormInterface](../forminterface#method_isSubmitted "Symfony\Component\Form\FormInterface") | | string | [getName](#method_getName)() Returns the name by which the form is identified in forms. | from [FormInterface](../forminterface#method_getName "Symfony\Component\Form\FormInterface") | | [PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | [getPropertyPath](#method_getPropertyPath)() Returns the property path that the form is mapped to. | from [FormInterface](../forminterface#method_getPropertyPath "Symfony\Component\Form\FormInterface") | | $this | [addError](#method_addError)([FormError](../formerror "Symfony\Component\Form\FormError") $error) Adds an error to this form. | from [FormInterface](../forminterface#method_addError "Symfony\Component\Form\FormInterface") | | bool | [isValid](#method_isValid)() Returns whether the form and all children are valid. | from [FormInterface](../forminterface#method_isValid "Symfony\Component\Form\FormInterface") | | bool | [isRequired](#method_isRequired)() Returns whether the form is required to be filled out. | from [FormInterface](../forminterface#method_isRequired "Symfony\Component\Form\FormInterface") | | bool | [isDisabled](#method_isDisabled)() Returns whether this form is disabled. | from [FormInterface](../forminterface#method_isDisabled "Symfony\Component\Form\FormInterface") | | bool | [isEmpty](#method_isEmpty)() Returns whether the form is empty. | from [FormInterface](../forminterface#method_isEmpty "Symfony\Component\Form\FormInterface") | | bool | [isSynchronized](#method_isSynchronized)() Returns whether the data in the different formats is synchronized. | from [FormInterface](../forminterface#method_isSynchronized "Symfony\Component\Form\FormInterface") | | [TransformationFailedException](../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | [getTransformationFailure](#method_getTransformationFailure)() Returns the data transformation failure, if any. | from [FormInterface](../forminterface#method_getTransformationFailure "Symfony\Component\Form\FormInterface") | | $this | [initialize](#method_initialize)() Initializes the form tree. | from [FormInterface](../forminterface#method_initialize "Symfony\Component\Form\FormInterface") | | $this | [handleRequest](#method_handleRequest)(mixed $request = null) Inspects the given request and calls {@link submit()} if the form was submitted. | from [FormInterface](../forminterface#method_handleRequest "Symfony\Component\Form\FormInterface") | | $this | [submit](#method_submit)(mixed $submittedData, bool $clearMissing = true) Submits data to the form, transforms and validates it. | from [FormInterface](../forminterface#method_submit "Symfony\Component\Form\FormInterface") | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | [getRoot](#method_getRoot)() Returns the root of the form tree. | from [FormInterface](../forminterface#method_getRoot "Symfony\Component\Form\FormInterface") | | bool | [isRoot](#method_isRoot)() Returns whether the field is the root of the form tree. | from [FormInterface](../forminterface#method_isRoot "Symfony\Component\Form\FormInterface") | | [FormView](../formview "Symfony\Component\Form\FormView") | [createView](#method_createView)([FormView](../formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. | from [FormInterface](../forminterface#method_createView "Symfony\Component\Form\FormInterface") | Details ------- ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") setParent([FormInterface](../forminterface "Symfony\Component\Form\FormInterface") $parent = null) Sets the parent form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | $parent | | #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](../exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](../exception/logicexception "Symfony\Component\Form\Exception\LogicException") | when trying to set a parent for a form with an empty name | ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")|null getParent() Returns the parent form. #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")|null | The parent form or null if there is none | ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") add([FormInterface](../forminterface "Symfony\Component\Form\FormInterface")|string|int $child, string|null $type = null, array $options = array()) Adds or replaces a child to the form. #### Parameters | | | | | --- | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")|string|int | $child | The FormInterface instance or the name of the child | | string|null | $type | The child's type, if a name was passed | | array | $options | The child's options, if a name was passed | #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](../exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](../exception/logicexception "Symfony\Component\Form\Exception\LogicException") | when trying to add a child to a non-compound form | | [UnexpectedTypeException](../exception/unexpectedtypeexception "Symfony\Component\Form\Exception\UnexpectedTypeException") | if $child or $type has an unexpected type | ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") get(string $name) Returns the child with the given name. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](http://php.net/OutOfBoundsException) | if the named child does not exist | ### bool has(string $name) Returns whether a child with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child | #### Return Value | | | | --- | --- | | bool | | ### $this remove(string $name) Removes a child from the form. #### Parameters | | | | | --- | --- | --- | | string | $name | The name of the child to remove | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](../exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")[] all() Returns all children in this group. #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface")[] | | ### [FormErrorIterator](../formerroriterator "Symfony\Component\Form\FormErrorIterator") getErrors(bool $deep = false, bool $flatten = true) Returns the errors of this form. #### Parameters | | | | | --- | --- | --- | | bool | $deep | Whether to include errors of child forms as well | | bool | $flatten | Whether to flatten the list of errors in case $deep is set to true | #### Return Value | | | | --- | --- | | [FormErrorIterator](../formerroriterator "Symfony\Component\Form\FormErrorIterator") | An iterator over the {@link FormError} instances that where added to this form | ### $this setData(mixed $modelData) Updates the form with default data. #### Parameters | | | | | --- | --- | --- | | mixed | $modelData | The data formatted as expected for the underlying object | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](../exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | | [LogicException](../exception/logicexception "Symfony\Component\Form\Exception\LogicException") | If listeners try to call setData in a cycle. Or if the view data does not match the expected type according to {@link FormConfigInterface::getDataClass}. | ### mixed getData() Returns the data in the format needed for the underlying object. #### Return Value | | | | --- | --- | | mixed | | ### mixed getNormData() Returns the normalized data of the field. #### Return Value | | | | --- | --- | | mixed | when the field is not submitted, the default data is returned. When the field is submitted, the normalized submitted data is returned if the field is valid, null otherwise | ### mixed getViewData() Returns the data transformed by the value transformer. #### Return Value | | | | --- | --- | | mixed | | ### array getExtraData() Returns the extra data. #### Return Value | | | | --- | --- | | array | The submitted data which do not belong to a child | ### [FormConfigInterface](../formconfiginterface "Symfony\Component\Form\FormConfigInterface") getConfig() Returns the form's configuration. #### Return Value | | | | --- | --- | | [FormConfigInterface](../formconfiginterface "Symfony\Component\Form\FormConfigInterface") | The configuration | ### bool isSubmitted() Returns whether the form is submitted. #### Return Value | | | | --- | --- | | bool | true if the form is submitted, false otherwise | ### string getName() Returns the name by which the form is identified in forms. #### Return Value | | | | --- | --- | | string | The name of the form | ### [PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null getPropertyPath() Returns the property path that the form is mapped to. #### Return Value | | | | --- | --- | | [PropertyPathInterface](../../propertyaccess/propertypathinterface "Symfony\Component\PropertyAccess\PropertyPathInterface")|null | The property path | ### $this addError([FormError](../formerror "Symfony\Component\Form\FormError") $error) Adds an error to this form. #### Parameters | | | | | --- | --- | --- | | [FormError](../formerror "Symfony\Component\Form\FormError") | $error | | #### Return Value | | | | --- | --- | | $this | | ### bool isValid() Returns whether the form and all children are valid. #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Form\Exception\LogicException") | if the form is not submitted | ### bool isRequired() Returns whether the form is required to be filled out. If the form has a parent and the parent is not required, this method will always return false. Otherwise the value set with setRequired() is returned. #### Return Value | | | | --- | --- | | bool | | ### bool isDisabled() Returns whether this form is disabled. The content of a disabled form is displayed, but not allowed to be modified. The validation of modified disabled forms should fail. Forms whose parents are disabled are considered disabled regardless of their own state. #### Return Value | | | | --- | --- | | bool | | ### bool isEmpty() Returns whether the form is empty. #### Return Value | | | | --- | --- | | bool | | ### bool isSynchronized() Returns whether the data in the different formats is synchronized. If the data is not synchronized, you can get the transformation failure by calling {@link getTransformationFailure()}. #### Return Value | | | | --- | --- | | bool | | ### [TransformationFailedException](../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null getTransformationFailure() Returns the data transformation failure, if any. #### Return Value | | | | --- | --- | | [TransformationFailedException](../exception/transformationfailedexception "Symfony\Component\Form\Exception\TransformationFailedException")|null | The transformation failure | ### $this initialize() Initializes the form tree. Should be called on the root form after constructing the tree. #### Return Value | | | | --- | --- | | $this | | ### $this handleRequest(mixed $request = null) Inspects the given request and calls {@link submit()} if the form was submitted. Internally, the request is forwarded to the configured {@link RequestHandlerInterface} instance, which determines whether to submit the form or not. #### Parameters | | | | | --- | --- | --- | | mixed | $request | The request to handle | #### Return Value | | | | --- | --- | | $this | | ### $this submit(mixed $submittedData, bool $clearMissing = true) Submits data to the form, transforms and validates it. #### Parameters | | | | | --- | --- | --- | | mixed | $submittedData | The submitted data | | bool | $clearMissing | Whether to set fields to NULL when they are missing in the submitted data | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AlreadySubmittedException](../exception/alreadysubmittedexception "Symfony\Component\Form\Exception\AlreadySubmittedException") | if the form has already been submitted | ### [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") getRoot() Returns the root of the form tree. #### Return Value | | | | --- | --- | | [FormInterface](../forminterface "Symfony\Component\Form\FormInterface") | The root of the tree | ### bool isRoot() Returns whether the field is the root of the form tree. #### Return Value | | | | --- | --- | | bool | | ### [FormView](../formview "Symfony\Component\Form\FormView") createView([FormView](../formview "Symfony\Component\Form\FormView") $parent = null) Creates a view. #### Parameters | | | | | --- | --- | --- | | [FormView](../formview "Symfony\Component\Form\FormView") | $parent | | #### Return Value | | | | --- | --- | | [FormView](../formview "Symfony\Component\Form\FormView") | The view | symfony TypeTestCase TypeTestCase ============= abstract class **TypeTestCase** extends [FormIntegrationTestCase](formintegrationtestcase "Symfony\Component\Form\Test\FormIntegrationTestCase") Properties ---------- | | | | | | --- | --- | --- | --- | | protected [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | | from [FormIntegrationTestCase](formintegrationtestcase#property_factory "Symfony\Component\Form\Test\FormIntegrationTestCase") | | protected [FormBuilder](../formbuilder "Symfony\Component\Form\FormBuilder") | $builder | | | | protected [EventDispatcher](../../eventdispatcher/eventdispatcher "Symfony\Component\EventDispatcher\EventDispatcher") | $dispatcher | | | Methods ------- | | | | | --- | --- | --- | | | [setUp](#method_setUp)() | | | | [getExtensions](#method_getExtensions)() | | | | [getTypeExtensions](#method_getTypeExtensions)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getTypeExtensions "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [getTypes](#method_getTypes)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getTypes "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [getTypeGuessers](#method_getTypeGuessers)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getTypeGuessers "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [tearDown](#method_tearDown)() | | | static | [assertDateTimeEquals](#method_assertDateTimeEquals)([DateTime](http://php.net/DateTime) $expected, [DateTime](http://php.net/DateTime) $actual) | | | static | [assertDateIntervalEquals](#method_assertDateIntervalEquals)([DateInterval](http://php.net/DateInterval) $expected, [DateInterval](http://php.net/DateInterval) $actual) | | Details ------- ### protected setUp() ### protected getExtensions() ### protected getTypeExtensions() ### protected getTypes() ### protected getTypeGuessers() ### protected tearDown() ### static assertDateTimeEquals([DateTime](http://php.net/DateTime) $expected, [DateTime](http://php.net/DateTime) $actual) #### Parameters | | | | | --- | --- | --- | | [DateTime](http://php.net/DateTime) | $expected | | | [DateTime](http://php.net/DateTime) | $actual | | ### static assertDateIntervalEquals([DateInterval](http://php.net/DateInterval) $expected, [DateInterval](http://php.net/DateInterval) $actual) #### Parameters | | | | | --- | --- | --- | | [DateInterval](http://php.net/DateInterval) | $expected | | | [DateInterval](http://php.net/DateInterval) | $actual | |
programming_docs
symfony FormPerformanceTestCase FormPerformanceTestCase ======================== abstract class **FormPerformanceTestCase** extends [FormIntegrationTestCase](formintegrationtestcase "Symfony\Component\Form\Test\FormIntegrationTestCase") Base class for performance tests. Copied from Doctrine 2's OrmPerformanceTestCase. Properties ---------- | | | | | | --- | --- | --- | --- | | protected [FormFactoryInterface](../formfactoryinterface "Symfony\Component\Form\FormFactoryInterface") | $factory | | from [FormIntegrationTestCase](formintegrationtestcase#property_factory "Symfony\Component\Form\Test\FormIntegrationTestCase") | | protected int | $maxRunningTime | | | Methods ------- | | | | | --- | --- | --- | | | [setUp](#method_setUp)() | from [FormIntegrationTestCase](formintegrationtestcase#method_setUp "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [getExtensions](#method_getExtensions)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getExtensions "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [getTypeExtensions](#method_getTypeExtensions)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getTypeExtensions "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [getTypes](#method_getTypes)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getTypes "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [getTypeGuessers](#method_getTypeGuessers)() | from [FormIntegrationTestCase](formintegrationtestcase#method_getTypeGuessers "Symfony\Component\Form\Test\FormIntegrationTestCase") | | | [runTest](#method_runTest)() {@inheritdoc} | | | | [setMaxRunningTime](#method_setMaxRunningTime)(int $maxRunningTime) | | | int | [getMaxRunningTime](#method_getMaxRunningTime)() | | Details ------- ### protected setUp() ### protected getExtensions() ### protected getTypeExtensions() ### protected getTypes() ### protected getTypeGuessers() ### protected runTest() {@inheritdoc} ### setMaxRunningTime(int $maxRunningTime) #### Parameters | | | | | --- | --- | --- | | int | $maxRunningTime | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](http://php.net/InvalidArgumentException) | | ### int getMaxRunningTime() #### Return Value | | | | --- | --- | | int | | symfony Symfony\Component\Form\Test\Traits Symfony\Component\Form\Test\Traits ================================== Classes ------- | | | | --- | --- | | [ValidatorExtensionTrait](traits/validatorextensiontrait "Symfony\Component\Form\Test\Traits\ValidatorExtensionTrait") | | symfony ValidatorExtensionTrait ValidatorExtensionTrait ======================== trait **ValidatorExtensionTrait** Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $validator | | | Methods ------- | | | | | --- | --- | --- | | | [getValidatorExtension](#method_getValidatorExtension)() | | Details ------- ### protected getValidatorExtension() symfony OptionsResolverWrapper OptionsResolverWrapper ======================= class **OptionsResolverWrapper** extends [OptionsResolver](../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") Methods ------- | | | | | --- | --- | --- | | $this | [setDefault](#method_setDefault)(string $option, mixed $value) Sets the default value of a given option. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_setDefault "Symfony\Component\OptionsResolver\OptionsResolver") | | $this | [setDefaults](#method_setDefaults)(array $defaults) Sets a list of default values. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_setDefaults "Symfony\Component\OptionsResolver\OptionsResolver") | | bool | [hasDefault](#method_hasDefault)(string $option) Returns whether a default value is set for an option. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_hasDefault "Symfony\Component\OptionsResolver\OptionsResolver") | | $this | [setRequired](#method_setRequired)(string|string[] $optionNames) Marks one or more options as required. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_setRequired "Symfony\Component\OptionsResolver\OptionsResolver") | | bool | [isRequired](#method_isRequired)(string $option) Returns whether an option is required. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_isRequired "Symfony\Component\OptionsResolver\OptionsResolver") | | string[] | [getRequiredOptions](#method_getRequiredOptions)() Returns the names of all required options. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_getRequiredOptions "Symfony\Component\OptionsResolver\OptionsResolver") | | bool | [isMissing](#method_isMissing)(string $option) Returns whether an option is missing a default value. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_isMissing "Symfony\Component\OptionsResolver\OptionsResolver") | | string[] | [getMissingOptions](#method_getMissingOptions)() Returns the names of all options missing a default value. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_getMissingOptions "Symfony\Component\OptionsResolver\OptionsResolver") | | $this | [setDefined](#method_setDefined)(string|string[] $optionNames) Defines a valid option name. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_setDefined "Symfony\Component\OptionsResolver\OptionsResolver") | | bool | [isDefined](#method_isDefined)(string $option) Returns whether an option is defined. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_isDefined "Symfony\Component\OptionsResolver\OptionsResolver") | | string[] | [getDefinedOptions](#method_getDefinedOptions)() Returns the names of all defined options. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_getDefinedOptions "Symfony\Component\OptionsResolver\OptionsResolver") | | $this | [setNormalizer](#method_setNormalizer)(string $option, [Closure](http://php.net/Closure) $normalizer) Sets the normalizer for an option. | | | $this | [setAllowedValues](#method_setAllowedValues)(string $option, mixed $allowedValues) Sets allowed values for an option. | | | $this | [addAllowedValues](#method_addAllowedValues)(string $option, mixed $allowedValues) Adds allowed values for an option. | | | $this | [setAllowedTypes](#method_setAllowedTypes)(string $option, string|string[] $allowedTypes) Sets allowed types for an option. | | | $this | [addAllowedTypes](#method_addAllowedTypes)(string $option, string|string[] $allowedTypes) Adds allowed types for an option. | | | $this | [remove](#method_remove)(string|string[] $optionNames) Removes the option with the given name. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_remove "Symfony\Component\OptionsResolver\OptionsResolver") | | $this | [clear](#method_clear)() Removes all options. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_clear "Symfony\Component\OptionsResolver\OptionsResolver") | | array | [resolve](#method_resolve)(array $options = array()) Merges options with the default values stored in the container and validates them. | | | mixed | [offsetGet](#method_offsetGet)(string $option) Returns the resolved value of an option. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_offsetGet "Symfony\Component\OptionsResolver\OptionsResolver") | | bool | [offsetExists](#method_offsetExists)(string $option) Returns whether a resolved option with the given name exists. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_offsetExists "Symfony\Component\OptionsResolver\OptionsResolver") | | | [offsetSet](#method_offsetSet)($option, $value) Not supported. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_offsetSet "Symfony\Component\OptionsResolver\OptionsResolver") | | | [offsetUnset](#method_offsetUnset)($option) Not supported. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_offsetUnset "Symfony\Component\OptionsResolver\OptionsResolver") | | int | [count](#method_count)() Returns the number of set options. | from [OptionsResolver](../../optionsresolver/optionsresolver#method_count "Symfony\Component\OptionsResolver\OptionsResolver") | | | [getUndefinedOptions](#method_getUndefinedOptions)() | | Details ------- ### $this setDefault(string $option, mixed $value) Sets the default value of a given option. If the default value should be set based on other options, you can pass a closure with the following signature: ``` function (Options $options) { // ... } ``` The closure will be evaluated when {@link resolve()} is called. The closure has access to the resolved values of other options through the passed {@link Options} instance: ``` function (Options $options) { if (isset($options['port'])) { // ... } } ``` If you want to access the previously set default value, add a second argument to the closure's signature: ``` $options->setDefault('name', 'Default Name'); $options->setDefault('name', function (Options $options, $previousValue) { // 'Default Name' === $previousValue }); ``` This is mostly useful if the configuration of the {@link Options} object is spread across different locations of your code, such as base and sub-classes. #### Parameters | | | | | --- | --- | --- | | string | $option | The name of the option | | mixed | $value | The default value of the option | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this setDefaults(array $defaults) Sets a list of default values. #### Parameters | | | | | --- | --- | --- | | array | $defaults | The default values to set | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### bool hasDefault(string $option) Returns whether a default value is set for an option. Returns true if {@link setDefault()} was called for this option. An option is also considered set if it was set to null. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | Whether a default value is set | ### $this setRequired(string|string[] $optionNames) Marks one or more options as required. #### Parameters | | | | | --- | --- | --- | | string|string[] | $optionNames | One or more option names | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### bool isRequired(string $option) Returns whether an option is required. An option is required if it was passed to {@link setRequired()}. #### Parameters | | | | | --- | --- | --- | | string | $option | The name of the option | #### Return Value | | | | --- | --- | | bool | Whether the option is required | ### string[] getRequiredOptions() Returns the names of all required options. #### Return Value | | | | --- | --- | | string[] | The names of the required options | #### See also | | | | --- | --- | | isRequired() | | ### bool isMissing(string $option) Returns whether an option is missing a default value. An option is missing if it was passed to {@link setRequired()}, but not to {@link setDefault()}. This option must be passed explicitly to {@link resolve()}, otherwise an exception will be thrown. #### Parameters | | | | | --- | --- | --- | | string | $option | The name of the option | #### Return Value | | | | --- | --- | | bool | Whether the option is missing | ### string[] getMissingOptions() Returns the names of all options missing a default value. #### Return Value | | | | --- | --- | | string[] | The names of the missing options | #### See also | | | | --- | --- | | isMissing() | | ### $this setDefined(string|string[] $optionNames) Defines a valid option name. Defines an option name without setting a default value. The option will be accepted when passed to {@link resolve()}. When not passed, the option will not be included in the resolved options. #### Parameters | | | | | --- | --- | --- | | string|string[] | $optionNames | One or more option names | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### bool isDefined(string $option) Returns whether an option is defined. Returns true for any option passed to {@link setDefault()}, {@link setRequired()} or {@link setDefined()}. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | Whether the option is defined | ### string[] getDefinedOptions() Returns the names of all defined options. #### Return Value | | | | --- | --- | | string[] | The names of the defined options | #### See also | | | | --- | --- | | isDefined() | | ### $this setNormalizer(string $option, [Closure](http://php.net/Closure) $normalizer) Sets the normalizer for an option. The normalizer should be a closure with the following signature: ``` function (Options $options, $value) { // ... } ``` The closure is invoked when {@link resolve()} is called. The closure has access to the resolved values of other options through the passed {@link Options} instance. The second parameter passed to the closure is the value of the option. The resolved option value is set to the return value of the closure. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | [Closure](http://php.net/Closure) | $normalizer | The normalizer | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [UndefinedOptionsException](../../optionsresolver/exception/undefinedoptionsexception "Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException") | If the option is undefined | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this setAllowedValues(string $option, mixed $allowedValues) Sets allowed values for an option. Instead of passing values, you may also pass a closures with the following signature: ``` function ($value) { // return true or false } ``` The closure receives the value as argument and should return true to accept the value and false to reject the value. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $allowedValues | One or more acceptable values/closures | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [UndefinedOptionsException](../../optionsresolver/exception/undefinedoptionsexception "Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException") | If the option is undefined | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this addAllowedValues(string $option, mixed $allowedValues) Adds allowed values for an option. The values are merged with the allowed values defined previously. Instead of passing values, you may also pass a closures with the following signature: ``` function ($value) { // return true or false } ``` The closure receives the value as argument and should return true to accept the value and false to reject the value. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $allowedValues | One or more acceptable values/closures | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [UndefinedOptionsException](../../optionsresolver/exception/undefinedoptionsexception "Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException") | If the option is undefined | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this setAllowedTypes(string $option, string|string[] $allowedTypes) Sets allowed types for an option. Any type for which a corresponding is\_() function exists is acceptable. Additionally, fully-qualified class or interface names may be passed. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | string|string[] | $allowedTypes | One or more accepted types | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [UndefinedOptionsException](../../optionsresolver/exception/undefinedoptionsexception "Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException") | If the option is undefined | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this addAllowedTypes(string $option, string|string[] $allowedTypes) Adds allowed types for an option. The types are merged with the allowed types defined previously. Any type for which a corresponding is\_() function exists is acceptable. Additionally, fully-qualified class or interface names may be passed. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | string|string[] | $allowedTypes | One or more accepted types | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [UndefinedOptionsException](../../optionsresolver/exception/undefinedoptionsexception "Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException") | If the option is undefined | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this remove(string|string[] $optionNames) Removes the option with the given name. Undefined options are ignored. #### Parameters | | | | | --- | --- | --- | | string|string[] | $optionNames | One or more option names | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### $this clear() Removes all options. #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### array resolve(array $options = array()) Merges options with the default values stored in the container and validates them. Exceptions are thrown if: * Undefined options are passed; * Required options are missing; * Options have invalid types; * Options have invalid values. #### Parameters | | | | | --- | --- | --- | | array | $options | A map of option names to values | #### Return Value | | | | --- | --- | | array | The merged and validated options | #### Exceptions | | | | --- | --- | | [UndefinedOptionsException](../../optionsresolver/exception/undefinedoptionsexception "Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException") | If an option name is undefined | | [InvalidOptionsException](../../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | If an option doesn't fulfill the specified validation rules | | [MissingOptionsException](../../optionsresolver/exception/missingoptionsexception "Symfony\Component\OptionsResolver\Exception\MissingOptionsException") | If a required option is missing | | [OptionDefinitionException](../../optionsresolver/exception/optiondefinitionexception "Symfony\Component\OptionsResolver\Exception\OptionDefinitionException") | If there is a cyclic dependency between lazy options and/or normalizers | | [NoSuchOptionException](../../optionsresolver/exception/nosuchoptionexception "Symfony\Component\OptionsResolver\Exception\NoSuchOptionException") | If a lazy option reads an unavailable option | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If called from a lazy option or normalizer | ### mixed offsetGet(string $option) Returns the resolved value of an option. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The option value | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If accessing this method outside of {@link resolve()} | | [NoSuchOptionException](../../optionsresolver/exception/nosuchoptionexception "Symfony\Component\OptionsResolver\Exception\NoSuchOptionException") | If the option is not set | | [InvalidOptionsException](../../optionsresolver/exception/invalidoptionsexception "Symfony\Component\OptionsResolver\Exception\InvalidOptionsException") | If the option doesn't fulfill the specified validation rules | | [OptionDefinitionException](../../optionsresolver/exception/optiondefinitionexception "Symfony\Component\OptionsResolver\Exception\OptionDefinitionException") | If there is a cyclic dependency between lazy options and/or normalizers | ### bool offsetExists(string $option) Returns whether a resolved option with the given name exists. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | Whether the option is set | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If accessing this method outside of {@link resolve()} | #### See also | | | | --- | --- | | \ArrayAccess::offsetExists() | | ### offsetSet($option, $value) Not supported. #### Parameters | | | | | --- | --- | --- | | | $option | | | | $value | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | | ### offsetUnset($option) Not supported. #### Parameters | | | | | --- | --- | --- | | | $option | | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | | ### int count() Returns the number of set options. This may be only a subset of the defined options. #### Return Value | | | | --- | --- | | int | Number of options | #### Exceptions | | | | --- | --- | | [AccessException](../../optionsresolver/exception/accessexception "Symfony\Component\OptionsResolver\Exception\AccessException") | If accessing this method outside of {@link resolve()} | #### See also | | | | --- | --- | | \Countable::count() | | ### getUndefinedOptions()
programming_docs
symfony OrderedHashMap OrderedHashMap =============== class **OrderedHashMap** implements [ArrayAccess](http://php.net/ArrayAccess), [IteratorAggregate](http://php.net/IteratorAggregate), [Countable](http://php.net/Countable) A hash map which keeps track of deletions and additions. Like in associative arrays, elements can be mapped to integer or string keys. Unlike associative arrays, the map keeps track of the order in which keys were added and removed. This order is reflected during iteration. The map supports concurrent modification during iteration. That means that you can insert and remove elements from within a foreach loop and the iterator will reflect those changes accordingly. While elements that are added during the loop are recognized by the iterator, changed elements are not. Otherwise the loop could be infinite if each loop changes the current element: ``` $map = new OrderedHashMap(); $map[1] = 1; $map[2] = 2; $map[3] = 3; foreach ($map as $index => $value) { echo "$index: $value\n" if (1 === $index) { $map[1] = 4; $map[] = 5; } } print_r(iterator_to_array($map)); // => 1: 1 // 2: 2 // 3: 3 // 4: 5 // Array // ( // [1] => 4 // [2] => 2 // [3] => 3 // [4] => 5 // ) ``` The map also supports multiple parallel iterators. That means that you can nest foreach loops without affecting each other's iteration: ``` foreach ($map as $index => $value) { foreach ($map as $index2 => $value2) { // ... } } ``` Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $elements = array()) Creates a new map. | | | | [offsetExists](#method_offsetExists)($key) {@inheritdoc} | | | | [offsetGet](#method_offsetGet)($key) {@inheritdoc} | | | | [offsetSet](#method_offsetSet)($key, $value) {@inheritdoc} | | | | [offsetUnset](#method_offsetUnset)($key) {@inheritdoc} | | | | [getIterator](#method_getIterator)() {@inheritdoc} | | | | [count](#method_count)() {@inheritdoc} | | Details ------- ### \_\_construct(array $elements = array()) Creates a new map. #### Parameters | | | | | --- | --- | --- | | array | $elements | The elements to insert initially | ### offsetExists($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### offsetGet($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### offsetSet($key, $value) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | ### offsetUnset($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### getIterator() {@inheritdoc} ### count() {@inheritdoc} symfony FormUtil FormUtil ========= class **FormUtil** Methods ------- | | | | | --- | --- | --- | | static bool | [isEmpty](#method_isEmpty)(mixed $data) Returns whether the given data is empty. | | Details ------- ### static bool isEmpty(mixed $data) Returns whether the given data is empty. This logic is reused multiple times throughout the processing of a form and needs to be consistent. PHP's keyword `empty` cannot be used as it also considers 0 and "0" to be empty. #### Parameters | | | | | --- | --- | --- | | mixed | $data | | #### Return Value | | | | --- | --- | | bool | | symfony StringUtil StringUtil =========== class **StringUtil** Methods ------- | | | | | --- | --- | --- | | static string | [trim](#method_trim)(string $string) Returns the trimmed data. | | | static string|null | [fqcnToBlockPrefix](#method_fqcnToBlockPrefix)(string $fqcn) Converts a fully-qualified class name to a block prefix. | | Details ------- ### static string trim(string $string) Returns the trimmed data. #### Parameters | | | | | --- | --- | --- | | string | $string | | #### Return Value | | | | --- | --- | | string | | ### static string|null fqcnToBlockPrefix(string $fqcn) Converts a fully-qualified class name to a block prefix. #### Parameters | | | | | --- | --- | --- | | string | $fqcn | The fully-qualified class name | #### Return Value | | | | --- | --- | | string|null | The block prefix or null if not a valid FQCN | symfony OrderedHashMapIterator OrderedHashMapIterator ======================= class **OrderedHashMapIterator** implements [Iterator](http://php.net/Iterator) Iterator for {@link OrderedHashMap} objects. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $elements, array $orderedKeys, array $managedCursors) Creates a new iterator. | | | | [\_\_destruct](#method___destruct)() Removes the iterator's cursors from the managed cursors of the corresponding {@link OrderedHashMap} instance. | | | | [current](#method_current)() {@inheritdoc} | | | | [next](#method_next)() {@inheritdoc} | | | | [key](#method_key)() {@inheritdoc} | | | | [valid](#method_valid)() {@inheritdoc} | | | | [rewind](#method_rewind)() {@inheritdoc} | | Details ------- ### \_\_construct(array $elements, array $orderedKeys, array $managedCursors) Creates a new iterator. #### Parameters | | | | | --- | --- | --- | | array | $elements | The elements of the map, indexed by their keys | | array | $orderedKeys | The keys of the map in the order in which they should be iterated | | array | $managedCursors | An array from which to reference the iterator's cursor as long as it is alive. This array is managed by the corresponding {@link OrderedHashMap} instance to support recognizing the deletion of elements. | ### \_\_destruct() Removes the iterator's cursors from the managed cursors of the corresponding {@link OrderedHashMap} instance. ### current() {@inheritdoc} ### next() {@inheritdoc} ### key() {@inheritdoc} ### valid() {@inheritdoc} ### rewind() {@inheritdoc} symfony InheritDataAwareIterator InheritDataAwareIterator ========================= class **InheritDataAwareIterator** extends [IteratorIterator](http://php.net/IteratorIterator) implements [RecursiveIterator](http://php.net/RecursiveIterator) Iterator that traverses an array of forms. Contrary to \ArrayIterator, this iterator recognizes changes in the original array during iteration. You can wrap the iterator into a {@link \RecursiveIteratorIterator} in order to enter any child form that inherits its parent's data and iterate the children of that form as well. Methods ------- | | | | | --- | --- | --- | | | [getChildren](#method_getChildren)() {@inheritdoc} | | | | [hasChildren](#method_hasChildren)() {@inheritdoc} | | Details ------- ### getChildren() {@inheritdoc} ### hasChildren() {@inheritdoc} symfony ServerParams ServerParams ============= class **ServerParams** Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([RequestStack](../../httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack = null) | | | bool | [hasPostMaxSizeBeenExceeded](#method_hasPostMaxSizeBeenExceeded)() Returns true if the POST max size has been exceeded in the request. | | | int|null | [getPostMaxSize](#method_getPostMaxSize)() Returns maximum post size in bytes. | | | string | [getNormalizedIniPostMaxSize](#method_getNormalizedIniPostMaxSize)() Returns the normalized "post\_max\_size" ini setting. | | | mixed | [getContentLength](#method_getContentLength)() Returns the content length of the request. | | Details ------- ### \_\_construct([RequestStack](../../httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") $requestStack = null) #### Parameters | | | | | --- | --- | --- | | [RequestStack](../../httpfoundation/requeststack "Symfony\Component\HttpFoundation\RequestStack") | $requestStack | | ### bool hasPostMaxSizeBeenExceeded() Returns true if the POST max size has been exceeded in the request. #### Return Value | | | | --- | --- | | bool | | ### int|null getPostMaxSize() Returns maximum post size in bytes. #### Return Value | | | | --- | --- | | int|null | The maximum post size in bytes | ### string getNormalizedIniPostMaxSize() Returns the normalized "post\_max\_size" ini setting. #### Return Value | | | | --- | --- | | string | | ### mixed getContentLength() Returns the content length of the request. #### Return Value | | | | --- | --- | | mixed | The request content length | symfony LazyChoiceList LazyChoiceList =============== class **LazyChoiceList** implements [ChoiceListInterface](choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") A choice list that loads its choices lazily. The choices are fetched using a {@link ChoiceLoaderInterface} instance. If only {@link getChoicesForValues()} or {@link getValuesForChoices()} is called, the choice list is only loaded partially for improved performance. Once {@link getChoices()} or {@link getValues()} is called, the list is loaded fully. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ChoiceLoaderInterface](loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable $value = null) Creates a lazily-loaded list using the given loader. | | | array | [getChoices](#method_getChoices)() Returns all selectable choices. | | | string[] | [getValues](#method_getValues)() Returns the values for the choices. | | | string[] | [getStructuredValues](#method_getStructuredValues)() Returns the values in the structure originally passed to the list. | | | int[]|string[] | [getOriginalKeys](#method_getOriginalKeys)() Returns the original keys of the choices. | | | array | [getChoicesForValues](#method_getChoicesForValues)(array $values) Returns the choices corresponding to the given values. | | | string[] | [getValuesForChoices](#method_getValuesForChoices)(array $choices) Returns the values corresponding to the given choices. | | Details ------- ### \_\_construct([ChoiceLoaderInterface](loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable $value = null) Creates a lazily-loaded list using the given loader. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | [ChoiceLoaderInterface](loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") | $loader | The choice loader | | callable | $value | The callable generating the choice values | ### array getChoices() Returns all selectable choices. #### Return Value | | | | --- | --- | | array | The selectable choices indexed by the corresponding values | ### string[] getValues() Returns the values for the choices. The values are strings that do not contain duplicates. #### Return Value | | | | --- | --- | | string[] | The choice values | ### string[] getStructuredValues() Returns the values in the structure originally passed to the list. Contrary to {@link getValues()}, the result is indexed by the original keys of the choices. If the original array contained nested arrays, these nested arrays are represented here as well: ``` $form->add('field', 'choice', array( 'choices' => array( 'Decided' => array('Yes' => true, 'No' => false), 'Undecided' => array('Maybe' => null), ), )); ``` In this example, the result of this method is: ``` array( 'Decided' => array('Yes' => '0', 'No' => '1'), 'Undecided' => array('Maybe' => '2'), ) ``` #### Return Value | | | | --- | --- | | string[] | The choice values | ### int[]|string[] getOriginalKeys() Returns the original keys of the choices. The original keys are the keys of the choice array that was passed in the "choice" option of the choice type. Note that this array may contain duplicates if the "choice" option contained choice groups: ``` $form->add('field', 'choice', array( 'choices' => array( 'Decided' => array(true, false), 'Undecided' => array(null), ), )); ``` In this example, the original key 0 appears twice, once for `true` and once for `null`. #### Return Value | | | | --- | --- | | int[]|string[] | The original choice keys indexed by the corresponding choice values | ### array getChoicesForValues(array $values) Returns the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] getValuesForChoices(array $choices) Returns the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony Symfony\Component\Form\ChoiceList\Loader Symfony\Component\Form\ChoiceList\Loader ======================================== Classes ------- | | | | --- | --- | | [CallbackChoiceLoader](loader/callbackchoiceloader "Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader") | Loads an {@link ArrayChoiceList} instance from a callable returning an array of choices. | | [IntlCallbackChoiceLoader](loader/intlcallbackchoiceloader "Symfony\Component\Form\ChoiceList\Loader\IntlCallbackChoiceLoader") | Callback choice loader optimized for Intl choice types. | Interfaces ---------- | | | | --- | --- | | *[ChoiceLoaderInterface](loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface")* | Loads a choice list. | symfony Symfony\Component\Form\ChoiceList\Factory Symfony\Component\Form\ChoiceList\Factory ========================================= Classes ------- | | | | --- | --- | | [CachingFactoryDecorator](factory/cachingfactorydecorator "Symfony\Component\Form\ChoiceList\Factory\CachingFactoryDecorator") | Caches the choice lists created by the decorated factory. | | [DefaultChoiceListFactory](factory/defaultchoicelistfactory "Symfony\Component\Form\ChoiceList\Factory\DefaultChoiceListFactory") | Default implementation of {@link ChoiceListFactoryInterface}. | | [PropertyAccessDecorator](factory/propertyaccessdecorator "Symfony\Component\Form\ChoiceList\Factory\PropertyAccessDecorator") | Adds property path support to a choice list factory. | Interfaces ---------- | | | | --- | --- | | *[ChoiceListFactoryInterface](factory/choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface")* | Creates {@link ChoiceListInterface} instances. | symfony ChoiceListInterface ChoiceListInterface ==================== interface **ChoiceListInterface** A list of choices that can be selected in a choice field. A choice list assigns unique string values to each of a list of choices. These string values are displayed in the "value" attributes in HTML and submitted back to the server. The acceptable data types for the choices depend on the implementation. Values must always be strings and (within the list) free of duplicates. Methods ------- | | | | | --- | --- | --- | | array | [getChoices](#method_getChoices)() Returns all selectable choices. | | | string[] | [getValues](#method_getValues)() Returns the values for the choices. | | | string[] | [getStructuredValues](#method_getStructuredValues)() Returns the values in the structure originally passed to the list. | | | int[]|string[] | [getOriginalKeys](#method_getOriginalKeys)() Returns the original keys of the choices. | | | array | [getChoicesForValues](#method_getChoicesForValues)(array $values) Returns the choices corresponding to the given values. | | | string[] | [getValuesForChoices](#method_getValuesForChoices)(array $choices) Returns the values corresponding to the given choices. | | Details ------- ### array getChoices() Returns all selectable choices. #### Return Value | | | | --- | --- | | array | The selectable choices indexed by the corresponding values | ### string[] getValues() Returns the values for the choices. The values are strings that do not contain duplicates. #### Return Value | | | | --- | --- | | string[] | The choice values | ### string[] getStructuredValues() Returns the values in the structure originally passed to the list. Contrary to {@link getValues()}, the result is indexed by the original keys of the choices. If the original array contained nested arrays, these nested arrays are represented here as well: ``` $form->add('field', 'choice', array( 'choices' => array( 'Decided' => array('Yes' => true, 'No' => false), 'Undecided' => array('Maybe' => null), ), )); ``` In this example, the result of this method is: ``` array( 'Decided' => array('Yes' => '0', 'No' => '1'), 'Undecided' => array('Maybe' => '2'), ) ``` #### Return Value | | | | --- | --- | | string[] | The choice values | ### int[]|string[] getOriginalKeys() Returns the original keys of the choices. The original keys are the keys of the choice array that was passed in the "choice" option of the choice type. Note that this array may contain duplicates if the "choice" option contained choice groups: ``` $form->add('field', 'choice', array( 'choices' => array( 'Decided' => array(true, false), 'Undecided' => array(null), ), )); ``` In this example, the original key 0 appears twice, once for `true` and once for `null`. #### Return Value | | | | --- | --- | | int[]|string[] | The original choice keys indexed by the corresponding choice values | ### array getChoicesForValues(array $values) Returns the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] getValuesForChoices(array $choices) Returns the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony Symfony\Component\Form\ChoiceList\View Symfony\Component\Form\ChoiceList\View ====================================== Classes ------- | | | | --- | --- | | [ChoiceGroupView](view/choicegroupview "Symfony\Component\Form\ChoiceList\View\ChoiceGroupView") | Represents a group of choices in templates. | | [ChoiceListView](view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | Represents a choice list in templates. | | [ChoiceView](view/choiceview "Symfony\Component\Form\ChoiceList\View\ChoiceView") | Represents a choice in templates. | symfony ArrayChoiceList ArrayChoiceList ================ class **ArrayChoiceList** implements [ChoiceListInterface](choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") A list of choices with arbitrary data types. The user of this class is responsible for assigning string values to the choices. Both the choices and their values are passed to the constructor. Each choice must have a corresponding value (with the same array key) in the value array. Properties ---------- | | | | | | --- | --- | --- | --- | | protected array | $choices | The choices in the list. | | | protected array | $structuredValues | The values indexed by the original keys. | | | protected int[]|string[] | $originalKeys | The original keys of the choices array. | | | protected callable | $valueCallback | The callback for creating the value for a choice. | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(iterable $choices, callable $value = null) Creates a list with the given choices and values. | | | array | [getChoices](#method_getChoices)() Returns all selectable choices. | | | string[] | [getValues](#method_getValues)() Returns the values for the choices. | | | string[] | [getStructuredValues](#method_getStructuredValues)() Returns the values in the structure originally passed to the list. | | | int[]|string[] | [getOriginalKeys](#method_getOriginalKeys)() Returns the original keys of the choices. | | | array | [getChoicesForValues](#method_getChoicesForValues)(array $values) Returns the choices corresponding to the given values. | | | string[] | [getValuesForChoices](#method_getValuesForChoices)(array $choices) Returns the values corresponding to the given choices. | | | | [flatten](#method_flatten)(array $choices, callable $value, array $choicesByValues, array $keysByValues, array $structuredValues) Flattens an array into the given output variables. | | Details ------- ### \_\_construct(iterable $choices, callable $value = null) Creates a list with the given choices and values. The given choice array must have the same array keys as the value array. #### Parameters | | | | | --- | --- | --- | | iterable | $choices | The selectable choices | | callable | $value | The callable for creating the value for a choice. If `null` is passed, incrementing integers are used as values | ### array getChoices() Returns all selectable choices. #### Return Value | | | | --- | --- | | array | The selectable choices indexed by the corresponding values | ### string[] getValues() Returns the values for the choices. The values are strings that do not contain duplicates. #### Return Value | | | | --- | --- | | string[] | The choice values | ### string[] getStructuredValues() Returns the values in the structure originally passed to the list. Contrary to {@link getValues()}, the result is indexed by the original keys of the choices. If the original array contained nested arrays, these nested arrays are represented here as well: ``` $form->add('field', 'choice', array( 'choices' => array( 'Decided' => array('Yes' => true, 'No' => false), 'Undecided' => array('Maybe' => null), ), )); ``` In this example, the result of this method is: ``` array( 'Decided' => array('Yes' => '0', 'No' => '1'), 'Undecided' => array('Maybe' => '2'), ) ``` #### Return Value | | | | --- | --- | | string[] | The choice values | ### int[]|string[] getOriginalKeys() Returns the original keys of the choices. The original keys are the keys of the choice array that was passed in the "choice" option of the choice type. Note that this array may contain duplicates if the "choice" option contained choice groups: ``` $form->add('field', 'choice', array( 'choices' => array( 'Decided' => array(true, false), 'Undecided' => array(null), ), )); ``` In this example, the original key 0 appears twice, once for `true` and once for `null`. #### Return Value | | | | --- | --- | | int[]|string[] | The original choice keys indexed by the corresponding choice values | ### array getChoicesForValues(array $values) Returns the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] getValuesForChoices(array $choices) Returns the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | #### Return Value | | | | --- | --- | | string[] | An array of choice values | ### protected flatten(array $choices, callable $value, array $choicesByValues, array $keysByValues, array $structuredValues) Flattens an array into the given output variables. #### Parameters | | | | | --- | --- | --- | | array | $choices | The array to flatten | | callable | $value | The callable for generating choice values | | array | $choicesByValues | The flattened choices indexed by the corresponding values | | array | $keysByValues | The original keys indexed by the corresponding values | | array | $structuredValues | The values indexed by the original keys |
programming_docs
symfony ChoiceLoaderInterface ChoiceLoaderInterface ====================== interface **ChoiceLoaderInterface** Loads a choice list. The methods {@link loadChoicesForValues()} and {@link loadValuesForChoices()} can be used to load the list only partially in cases where a fully-loaded list is not necessary. Methods ------- | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) Loads a list of choices. | | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) Loads the values corresponding to the given choices. | | Details ------- ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony IntlCallbackChoiceLoader IntlCallbackChoiceLoader ========================= class **IntlCallbackChoiceLoader** extends [CallbackChoiceLoader](callbackchoiceloader "Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader") Callback choice loader optimized for Intl choice types. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(callable $callback) | from [CallbackChoiceLoader](callbackchoiceloader#method___construct "Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader") | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) Loads a list of choices. | from [CallbackChoiceLoader](callbackchoiceloader#method_loadChoiceList "Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader") | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) Loads the values corresponding to the given choices. | | Details ------- ### \_\_construct(callable $callback) #### Parameters | | | | | --- | --- | --- | | callable | $callback | The callable returning an array of choices | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony CallbackChoiceLoader CallbackChoiceLoader ===================== class **CallbackChoiceLoader** implements [ChoiceLoaderInterface](choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") Loads an {@link ArrayChoiceList} instance from a callable returning an array of choices. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(callable $callback) | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [loadChoiceList](#method_loadChoiceList)(callable|null $value = null) Loads a list of choices. | | | array | [loadChoicesForValues](#method_loadChoicesForValues)(array $values, callable|null $value = null) Loads the choices corresponding to the given values. | | | string[] | [loadValuesForChoices](#method_loadValuesForChoices)(array $choices, callable|null $value = null) Loads the values corresponding to the given choices. | | Details ------- ### \_\_construct(callable $callback) #### Parameters | | | | | --- | --- | --- | | callable | $callback | The callable returning an array of choices | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") loadChoiceList(callable|null $value = null) Loads a list of choices. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | callable|null | $value | The callable which generates the values from choices | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The loaded choice list | ### array loadChoicesForValues(array $values, callable|null $value = null) Loads the choices corresponding to the given values. The choices are returned with the same keys and in the same order as the corresponding values in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of choice values. Non-existing values in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | array | An array of choices | ### string[] loadValuesForChoices(array $choices, callable|null $value = null) Loads the values corresponding to the given choices. The values are returned with the same keys and in the same order as the corresponding choices in the given array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | array | $choices | An array of choices. Non-existing choices in this array are ignored | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | string[] | An array of choice values | symfony ChoiceListView ChoiceListView =============== class **ChoiceListView** Represents a choice list in templates. A choice list contains choices and optionally preferred choices which are displayed in the very beginning of the list. Both choices and preferred choices may be grouped in {@link ChoiceGroupView} instances. Properties ---------- | | | | | | --- | --- | --- | --- | | | $choices | | | | | $preferredChoices | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $choices = array(), array $preferredChoices = array()) Creates a new choice list view. | | | bool | [hasPlaceholder](#method_hasPlaceholder)() Returns whether a placeholder is in the choices. | | Details ------- ### \_\_construct(array $choices = array(), array $preferredChoices = array()) Creates a new choice list view. #### Parameters | | | | | --- | --- | --- | | array | $choices | The choice views | | array | $preferredChoices | the preferred choice views | ### bool hasPlaceholder() Returns whether a placeholder is in the choices. A placeholder must be the first child element, not be in a group and have an empty value. #### Return Value | | | | --- | --- | | bool | | symfony ChoiceGroupView ChoiceGroupView ================ class **ChoiceGroupView** implements [IteratorAggregate](http://php.net/IteratorAggregate) Represents a group of choices in templates. Properties ---------- | | | | | | --- | --- | --- | --- | | | $label | | | | | $choices | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $label, array $choices = array()) Creates a new choice group view. | | | [ChoiceGroupView](choicegroupview "Symfony\Component\Form\ChoiceList\View\ChoiceGroupView")[]|[ChoiceView](choiceview "Symfony\Component\Form\ChoiceList\View\ChoiceView")[] | [getIterator](#method_getIterator)() {@inheritdoc} | | Details ------- ### \_\_construct(string $label, array $choices = array()) Creates a new choice group view. #### Parameters | | | | | --- | --- | --- | | string | $label | The label of the group | | array | $choices | the choice views in the group | ### [ChoiceGroupView](choicegroupview "Symfony\Component\Form\ChoiceList\View\ChoiceGroupView")[]|[ChoiceView](choiceview "Symfony\Component\Form\ChoiceList\View\ChoiceView")[] getIterator() {@inheritdoc} #### Return Value | | | | --- | --- | | [ChoiceGroupView](choicegroupview "Symfony\Component\Form\ChoiceList\View\ChoiceGroupView")[]|[ChoiceView](choiceview "Symfony\Component\Form\ChoiceList\View\ChoiceView")[] | | symfony ChoiceView ChoiceView =========== class **ChoiceView** Represents a choice in templates. Properties ---------- | | | | | | --- | --- | --- | --- | | | $label | | | | | $value | | | | | $data | | | | | $attr | Additional attributes for the HTML tag. | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(mixed $data, string $value, string $label, array $attr = array()) Creates a new choice view. | | Details ------- ### \_\_construct(mixed $data, string $value, string $label, array $attr = array()) Creates a new choice view. #### Parameters | | | | | --- | --- | --- | | mixed | $data | The original choice | | string | $value | The view representation of the choice | | string | $label | The label displayed to humans | | array | $attr | Additional attributes for the HTML tag | symfony DefaultChoiceListFactory DefaultChoiceListFactory ========================= class **DefaultChoiceListFactory** implements [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") Default implementation of {@link ChoiceListFactoryInterface}. Methods ------- | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromChoices](#method_createListFromChoices)(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromLoader](#method_createListFromLoader)([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. | | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | [createView](#method_createView)([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. | | Details ------- ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromChoices(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. The choices should be passed in the values of the choices array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | iterable | $choices | The choices | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromLoader([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | [ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") | $loader | The choice loader | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") createView([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. Callables may be passed for all optional arguments. The callables receive the choice as first and the array key as the second argument. * The callable for the label and the name should return the generated label/choice name. * The callable for the preferred choices should return true or false, depending on whether the choice should be preferred or not. * The callable for the grouping should return the group name or null if a choice should not be grouped. * The callable for the attributes should return an array of HTML attributes that will be inserted in the tag of the choice. If no callable is passed, the labels will be generated from the choice keys. The view indices will be generated using an incrementing integer by default. The preferred choices can also be passed as array. Each choice that is contained in that array will be marked as preferred. The attributes can be passed as multi-dimensional array. The keys should match the keys of the choices. The values should be arrays of HTML attributes that should be added to the respective choice. #### Parameters | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | $list | The choice list | | array|callable|null | $preferredChoices | The preferred choices | | callable|null | $label | The callable generating the choice labels | | callable|null | $index | The callable generating the view indices | | callable|null | $groupBy | The callable generating the group names | | array|callable|null | $attr | The callable generating the HTML attributes | #### Return Value | | | | --- | --- | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | The choice list view | symfony ChoiceListFactoryInterface ChoiceListFactoryInterface =========================== interface **ChoiceListFactoryInterface** Creates {@link ChoiceListInterface} instances. Methods ------- | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromChoices](#method_createListFromChoices)(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromLoader](#method_createListFromLoader)([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. | | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | [createView](#method_createView)([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. | | Details ------- ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromChoices(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. The choices should be passed in the values of the choices array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | iterable | $choices | The choices | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromLoader([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | [ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") | $loader | The choice loader | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") createView([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. Callables may be passed for all optional arguments. The callables receive the choice as first and the array key as the second argument. * The callable for the label and the name should return the generated label/choice name. * The callable for the preferred choices should return true or false, depending on whether the choice should be preferred or not. * The callable for the grouping should return the group name or null if a choice should not be grouped. * The callable for the attributes should return an array of HTML attributes that will be inserted in the tag of the choice. If no callable is passed, the labels will be generated from the choice keys. The view indices will be generated using an incrementing integer by default. The preferred choices can also be passed as array. Each choice that is contained in that array will be marked as preferred. The attributes can be passed as multi-dimensional array. The keys should match the keys of the choices. The values should be arrays of HTML attributes that should be added to the respective choice. #### Parameters | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | $list | The choice list | | array|callable|null | $preferredChoices | The preferred choices | | callable|null | $label | The callable generating the choice labels | | callable|null | $index | The callable generating the view indices | | callable|null | $groupBy | The callable generating the group names | | array|callable|null | $attr | The callable generating the HTML attributes | #### Return Value | | | | --- | --- | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | The choice list view |
programming_docs
symfony CachingFactoryDecorator CachingFactoryDecorator ======================== class **CachingFactoryDecorator** implements [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") Caches the choice lists created by the decorated factory. Methods ------- | | | | | --- | --- | --- | | static string | [generateHash](#method_generateHash)(mixed $value, string $namespace = '') Generates a SHA-256 hash for the given value. | | | | [\_\_construct](#method___construct)([ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $decoratedFactory) | | | [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | [getDecoratedFactory](#method_getDecoratedFactory)() Returns the decorated factory. | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromChoices](#method_createListFromChoices)(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromLoader](#method_createListFromLoader)([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. | | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | [createView](#method_createView)([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. | | Details ------- ### static string generateHash(mixed $value, string $namespace = '') Generates a SHA-256 hash for the given value. Optionally, a namespace string can be passed. Calling this method will the same values, but different namespaces, will return different hashes. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to hash | | string | $namespace | Optional. The namespace | #### Return Value | | | | --- | --- | | string | The SHA-256 hash | ### \_\_construct([ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $decoratedFactory) #### Parameters | | | | | --- | --- | --- | | [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | $decoratedFactory | | ### [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") getDecoratedFactory() Returns the decorated factory. #### Return Value | | | | --- | --- | | [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | The decorated factory | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromChoices(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. The choices should be passed in the values of the choices array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | iterable | $choices | The choices | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromLoader([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | [ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") | $loader | The choice loader | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") createView([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. Callables may be passed for all optional arguments. The callables receive the choice as first and the array key as the second argument. * The callable for the label and the name should return the generated label/choice name. * The callable for the preferred choices should return true or false, depending on whether the choice should be preferred or not. * The callable for the grouping should return the group name or null if a choice should not be grouped. * The callable for the attributes should return an array of HTML attributes that will be inserted in the tag of the choice. If no callable is passed, the labels will be generated from the choice keys. The view indices will be generated using an incrementing integer by default. The preferred choices can also be passed as array. Each choice that is contained in that array will be marked as preferred. The attributes can be passed as multi-dimensional array. The keys should match the keys of the choices. The values should be arrays of HTML attributes that should be added to the respective choice. #### Parameters | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | $list | The choice list | | array|callable|null | $preferredChoices | The preferred choices | | callable|null | $label | The callable generating the choice labels | | callable|null | $index | The callable generating the view indices | | callable|null | $groupBy | The callable generating the group names | | array|callable|null | $attr | The callable generating the HTML attributes | #### Return Value | | | | --- | --- | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | The choice list view | symfony PropertyAccessDecorator PropertyAccessDecorator ======================== class **PropertyAccessDecorator** implements [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") Adds property path support to a choice list factory. Pass the decorated factory to the constructor: ``` $decorator = new PropertyAccessDecorator($factory); ``` You can now pass property paths for generating choice values, labels, view indices, HTML attributes and for determining the preferred choices and the choice groups: ``` // extract values from the $value property $list = $createListFromChoices($objects, 'value'); ``` Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $decoratedFactory, [PropertyAccessorInterface](../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null) | | | [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | [getDecoratedFactory](#method_getDecoratedFactory)() Returns the decorated factory. | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromChoices](#method_createListFromChoices)(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. | | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | [createListFromLoader](#method_createListFromLoader)([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. | | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | [createView](#method_createView)([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. | | Details ------- ### \_\_construct([ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") $decoratedFactory, [PropertyAccessorInterface](../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | $decoratedFactory | | | [PropertyAccessorInterface](../../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") | $propertyAccessor | | ### [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") getDecoratedFactory() Returns the decorated factory. #### Return Value | | | | --- | --- | | [ChoiceListFactoryInterface](choicelistfactoryinterface "Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface") | The decorated factory | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromChoices(iterable $choices, callable|null $value = null) Creates a choice list for the given choices. The choices should be passed in the values of the choices array. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | iterable | $choices | The choices | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") createListFromLoader([ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") $loader, callable|null $value = null) Creates a choice list that is loaded with the given loader. Optionally, a callable can be passed for generating the choice values. The callable receives the choice as first and the array key as the second argument. #### Parameters | | | | | --- | --- | --- | | [ChoiceLoaderInterface](../loader/choiceloaderinterface "Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface") | $loader | The choice loader | | callable|null | $value | The callable generating the choice values | #### Return Value | | | | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | The choice list | ### [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") createView([ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") $list, array|callable|null $preferredChoices = null, callable|null $label = null, callable|null $index = null, callable|null $groupBy = null, array|callable|null $attr = null) Creates a view for the given choice list. Callables may be passed for all optional arguments. The callables receive the choice as first and the array key as the second argument. * The callable for the label and the name should return the generated label/choice name. * The callable for the preferred choices should return true or false, depending on whether the choice should be preferred or not. * The callable for the grouping should return the group name or null if a choice should not be grouped. * The callable for the attributes should return an array of HTML attributes that will be inserted in the tag of the choice. If no callable is passed, the labels will be generated from the choice keys. The view indices will be generated using an incrementing integer by default. The preferred choices can also be passed as array. Each choice that is contained in that array will be marked as preferred. The attributes can be passed as multi-dimensional array. The keys should match the keys of the choices. The values should be arrays of HTML attributes that should be added to the respective choice. #### Parameters | | | | | --- | --- | --- | | [ChoiceListInterface](../choicelistinterface "Symfony\Component\Form\ChoiceList\ChoiceListInterface") | $list | The choice list | | array|callable|null | $preferredChoices | The preferred choices | | callable|null | $label | The callable generating the choice labels | | callable|null | $index | The callable generating the view indices | | callable|null | $groupBy | The callable generating the group names | | array|callable|null | $attr | The callable generating the HTML attributes | #### Return Value | | | | --- | --- | | [ChoiceListView](../view/choicelistview "Symfony\Component\Form\ChoiceList\View\ChoiceListView") | The choice list view | symfony Guess Guess ====== abstract class **Guess** Base class for guesses made by TypeGuesserInterface implementation. Each instance contains a confidence value about the correctness of the guess. Thus an instance with confidence HIGH\_CONFIDENCE is more likely to be correct than an instance with confidence LOW\_CONFIDENCE. Constants --------- | | | | --- | --- | | VERY\_HIGH\_CONFIDENCE | *Marks an instance with a value that is extremely likely to be correct.* | | HIGH\_CONFIDENCE | *Marks an instance with a value that is very likely to be correct.* | | MEDIUM\_CONFIDENCE | *Marks an instance with a value that is likely to be correct.* | | LOW\_CONFIDENCE | *Marks an instance with a value that may be correct.* | Methods ------- | | | | | --- | --- | --- | | static [Guess](guess "Symfony\Component\Form\Guess\Guess")|null | [getBestGuess](#method_getBestGuess)(array $guesses) Returns the guess most likely to be correct from a list of guesses. | | | | [\_\_construct](#method___construct)(int $confidence) | | | int | [getConfidence](#method_getConfidence)() Returns the confidence that the guessed value is correct. | | Details ------- ### static [Guess](guess "Symfony\Component\Form\Guess\Guess")|null getBestGuess(array $guesses) Returns the guess most likely to be correct from a list of guesses. If there are multiple guesses with the same, highest confidence, the returned guess is any of them. #### Parameters | | | | | --- | --- | --- | | array | $guesses | An array of guesses | #### Return Value | | | | --- | --- | | [Guess](guess "Symfony\Component\Form\Guess\Guess")|null | | ### \_\_construct(int $confidence) #### Parameters | | | | | --- | --- | --- | | int | $confidence | The confidence | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") | if the given value of confidence is unknown | ### int getConfidence() Returns the confidence that the guessed value is correct. #### Return Value | | | | --- | --- | | int | One of the constants VERY\_HIGH\_CONFIDENCE, HIGH\_CONFIDENCE, MEDIUM\_CONFIDENCE and LOW\_CONFIDENCE | symfony TypeGuess TypeGuess ========== class **TypeGuess** extends [Guess](guess "Symfony\Component\Form\Guess\Guess") Contains a guessed class name and a list of options for creating an instance of that class. Constants --------- | | | | --- | --- | | VERY\_HIGH\_CONFIDENCE | *Marks an instance with a value that is extremely likely to be correct.* | | HIGH\_CONFIDENCE | *Marks an instance with a value that is very likely to be correct.* | | MEDIUM\_CONFIDENCE | *Marks an instance with a value that is likely to be correct.* | | LOW\_CONFIDENCE | *Marks an instance with a value that may be correct.* | Methods ------- | | | | | --- | --- | --- | | static [Guess](guess "Symfony\Component\Form\Guess\Guess")|null | [getBestGuess](#method_getBestGuess)(array $guesses) Returns the guess most likely to be correct from a list of guesses. | from [Guess](guess#method_getBestGuess "Symfony\Component\Form\Guess\Guess") | | | [\_\_construct](#method___construct)(string $type, array $options, int $confidence) | | | int | [getConfidence](#method_getConfidence)() Returns the confidence that the guessed value is correct. | from [Guess](guess#method_getConfidence "Symfony\Component\Form\Guess\Guess") | | string | [getType](#method_getType)() Returns the guessed field type. | | | array | [getOptions](#method_getOptions)() Returns the guessed options for creating instances of the guessed type. | | Details ------- ### static [Guess](guess "Symfony\Component\Form\Guess\Guess")|null getBestGuess(array $guesses) Returns the guess most likely to be correct from a list of guesses. If there are multiple guesses with the same, highest confidence, the returned guess is any of them. #### Parameters | | | | | --- | --- | --- | | array | $guesses | An array of guesses | #### Return Value | | | | --- | --- | | [Guess](guess "Symfony\Component\Form\Guess\Guess")|null | | ### \_\_construct(string $type, array $options, int $confidence) #### Parameters | | | | | --- | --- | --- | | string | $type | The guessed field type | | array | $options | The options for creating instances of the guessed class | | int | $confidence | The confidence | ### int getConfidence() Returns the confidence that the guessed value is correct. #### Return Value | | | | --- | --- | | int | One of the constants VERY\_HIGH\_CONFIDENCE, HIGH\_CONFIDENCE, MEDIUM\_CONFIDENCE and LOW\_CONFIDENCE | ### string getType() Returns the guessed field type. #### Return Value | | | | --- | --- | | string | | ### array getOptions() Returns the guessed options for creating instances of the guessed type. #### Return Value | | | | --- | --- | | array | | symfony ValueGuess ValueGuess =========== class **ValueGuess** extends [Guess](guess "Symfony\Component\Form\Guess\Guess") Contains a guessed value. Constants --------- | | | | --- | --- | | VERY\_HIGH\_CONFIDENCE | *Marks an instance with a value that is extremely likely to be correct.* | | HIGH\_CONFIDENCE | *Marks an instance with a value that is very likely to be correct.* | | MEDIUM\_CONFIDENCE | *Marks an instance with a value that is likely to be correct.* | | LOW\_CONFIDENCE | *Marks an instance with a value that may be correct.* | Methods ------- | | | | | --- | --- | --- | | static [Guess](guess "Symfony\Component\Form\Guess\Guess")|null | [getBestGuess](#method_getBestGuess)(array $guesses) Returns the guess most likely to be correct from a list of guesses. | from [Guess](guess#method_getBestGuess "Symfony\Component\Form\Guess\Guess") | | | [\_\_construct](#method___construct)(string|int|bool|null $value, int $confidence) | | | int | [getConfidence](#method_getConfidence)() Returns the confidence that the guessed value is correct. | from [Guess](guess#method_getConfidence "Symfony\Component\Form\Guess\Guess") | | string|int|bool|null | [getValue](#method_getValue)() Returns the guessed value. | | Details ------- ### static [Guess](guess "Symfony\Component\Form\Guess\Guess")|null getBestGuess(array $guesses) Returns the guess most likely to be correct from a list of guesses. If there are multiple guesses with the same, highest confidence, the returned guess is any of them. #### Parameters | | | | | --- | --- | --- | | array | $guesses | An array of guesses | #### Return Value | | | | --- | --- | | [Guess](guess "Symfony\Component\Form\Guess\Guess")|null | | ### \_\_construct(string|int|bool|null $value, int $confidence) #### Parameters | | | | | --- | --- | --- | | string|int|bool|null | $value | The guessed value | | int | $confidence | The confidence | ### int getConfidence() Returns the confidence that the guessed value is correct. #### Return Value | | | | --- | --- | | int | One of the constants VERY\_HIGH\_CONFIDENCE, HIGH\_CONFIDENCE, MEDIUM\_CONFIDENCE and LOW\_CONFIDENCE | ### string|int|bool|null getValue() Returns the guessed value. #### Return Value | | | | --- | --- | | string|int|bool|null | |
programming_docs
symfony DebugCommand DebugCommand ============= class **DebugCommand** extends [Command](../../console/command/command "Symfony\Component\Console\Command\Command") A console command for retrieving information about form types. Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $defaultName | | | Methods ------- | | | | | --- | --- | --- | | static string|null | [getDefaultName](#method_getDefaultName)() | from [Command](../../console/command/command#method_getDefaultName "Symfony\Component\Console\Command\Command") | | | [\_\_construct](#method___construct)([FormRegistryInterface](../formregistryinterface "Symfony\Component\Form\FormRegistryInterface") $formRegistry, array $namespaces = array('Symfony\\Component\\Form\\Extension\\Core\\Type'), array $types = array(), array $extensions = array(), array $guessers = array()) | | | | [ignoreValidationErrors](#method_ignoreValidationErrors)() Ignores validation errors. | from [Command](../../console/command/command#method_ignoreValidationErrors "Symfony\Component\Console\Command\Command") | | | [setApplication](#method_setApplication)([Application](../../console/application "Symfony\Component\Console\Application") $application = null) | from [Command](../../console/command/command#method_setApplication "Symfony\Component\Console\Command\Command") | | | [setHelperSet](#method_setHelperSet)([HelperSet](../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) | from [Command](../../console/command/command#method_setHelperSet "Symfony\Component\Console\Command\Command") | | [HelperSet](../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set. | from [Command](../../console/command/command#method_getHelperSet "Symfony\Component\Console\Command\Command") | | [Application](../../console/application "Symfony\Component\Console\Application") | [getApplication](#method_getApplication)() Gets the application instance for this command. | from [Command](../../console/command/command#method_getApplication "Symfony\Component\Console\Command\Command") | | bool | [isEnabled](#method_isEnabled)() Checks whether the command is enabled or not in the current environment. | from [Command](../../console/command/command#method_isEnabled "Symfony\Component\Console\Command\Command") | | | [configure](#method_configure)() Configures the current command. | | | int|null | [execute](#method_execute)([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. | | | | [interact](#method_interact)([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. | from [Command](../../console/command/command#method_interact "Symfony\Component\Console\Command\Command") | | | [initialize](#method_initialize)([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. | from [Command](../../console/command/command#method_initialize "Symfony\Component\Console\Command\Command") | | int | [run](#method_run)([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. | from [Command](../../console/command/command#method_run "Symfony\Component\Console\Command\Command") | | $this | [setCode](#method_setCode)(callable $code) Sets the code to execute when running this command. | from [Command](../../console/command/command#method_setCode "Symfony\Component\Console\Command\Command") | | | [mergeApplicationDefinition](#method_mergeApplicationDefinition)(bool $mergeArgs = true) Merges the application definition with the command definition. | from [Command](../../console/command/command#method_mergeApplicationDefinition "Symfony\Component\Console\Command\Command") | | $this | [setDefinition](#method_setDefinition)(array|[InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. | from [Command](../../console/command/command#method_setDefinition "Symfony\Component\Console\Command\Command") | | [InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getDefinition](#method_getDefinition)() Gets the InputDefinition attached to this Command. | from [Command](../../console/command/command#method_getDefinition "Symfony\Component\Console\Command\Command") | | [InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | [getNativeDefinition](#method_getNativeDefinition)() Gets the InputDefinition to be used to create representations of this Command. | from [Command](../../console/command/command#method_getNativeDefinition "Symfony\Component\Console\Command\Command") | | $this | [addArgument](#method_addArgument)(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. | from [Command](../../console/command/command#method_addArgument "Symfony\Component\Console\Command\Command") | | $this | [addOption](#method_addOption)(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. | from [Command](../../console/command/command#method_addOption "Symfony\Component\Console\Command\Command") | | $this | [setName](#method_setName)(string $name) Sets the name of the command. | from [Command](../../console/command/command#method_setName "Symfony\Component\Console\Command\Command") | | $this | [setProcessTitle](#method_setProcessTitle)(string $title) Sets the process title of the command. | from [Command](../../console/command/command#method_setProcessTitle "Symfony\Component\Console\Command\Command") | | string | [getName](#method_getName)() Returns the command name. | from [Command](../../console/command/command#method_getName "Symfony\Component\Console\Command\Command") | | [Command](../../console/command/command "Symfony\Component\Console\Command\Command") | [setHidden](#method_setHidden)(bool $hidden) | from [Command](../../console/command/command#method_setHidden "Symfony\Component\Console\Command\Command") | | bool | [isHidden](#method_isHidden)() | from [Command](../../console/command/command#method_isHidden "Symfony\Component\Console\Command\Command") | | $this | [setDescription](#method_setDescription)(string $description) Sets the description for the command. | from [Command](../../console/command/command#method_setDescription "Symfony\Component\Console\Command\Command") | | string | [getDescription](#method_getDescription)() Returns the description for the command. | from [Command](../../console/command/command#method_getDescription "Symfony\Component\Console\Command\Command") | | $this | [setHelp](#method_setHelp)(string $help) Sets the help for the command. | from [Command](../../console/command/command#method_setHelp "Symfony\Component\Console\Command\Command") | | string | [getHelp](#method_getHelp)() Returns the help for the command. | from [Command](../../console/command/command#method_getHelp "Symfony\Component\Console\Command\Command") | | string | [getProcessedHelp](#method_getProcessedHelp)() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. | from [Command](../../console/command/command#method_getProcessedHelp "Symfony\Component\Console\Command\Command") | | $this | [setAliases](#method_setAliases)(string[] $aliases) Sets the aliases for the command. | from [Command](../../console/command/command#method_setAliases "Symfony\Component\Console\Command\Command") | | array | [getAliases](#method_getAliases)() Returns the aliases for the command. | from [Command](../../console/command/command#method_getAliases "Symfony\Component\Console\Command\Command") | | string | [getSynopsis](#method_getSynopsis)(bool $short = false) Returns the synopsis for the command. | from [Command](../../console/command/command#method_getSynopsis "Symfony\Component\Console\Command\Command") | | $this | [addUsage](#method_addUsage)(string $usage) Add a command usage example. | from [Command](../../console/command/command#method_addUsage "Symfony\Component\Console\Command\Command") | | array | [getUsages](#method_getUsages)() Returns alternative usages of the command. | from [Command](../../console/command/command#method_getUsages "Symfony\Component\Console\Command\Command") | | mixed | [getHelper](#method_getHelper)(string $name) Gets a helper instance by name. | from [Command](../../console/command/command#method_getHelper "Symfony\Component\Console\Command\Command") | Details ------- ### static string|null getDefaultName() #### Return Value | | | | --- | --- | | string|null | The default command name or null when no default name is set | ### \_\_construct([FormRegistryInterface](../formregistryinterface "Symfony\Component\Form\FormRegistryInterface") $formRegistry, array $namespaces = array('Symfony\\Component\\Form\\Extension\\Core\\Type'), array $types = array(), array $extensions = array(), array $guessers = array()) #### Parameters | | | | | --- | --- | --- | | [FormRegistryInterface](../formregistryinterface "Symfony\Component\Form\FormRegistryInterface") | $formRegistry | | | array | $namespaces | | | array | $types | | | array | $extensions | | | array | $guessers | | #### Exceptions | | | | --- | --- | | [LogicException](../../console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When the command name is empty | ### ignoreValidationErrors() Ignores validation errors. This is mainly useful for the help command. ### setApplication([Application](../../console/application "Symfony\Component\Console\Application") $application = null) #### Parameters | | | | | --- | --- | --- | | [Application](../../console/application "Symfony\Component\Console\Application") | $application | | ### setHelperSet([HelperSet](../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet) #### Parameters | | | | | --- | --- | --- | | [HelperSet](../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | | ### [HelperSet](../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") getHelperSet() Gets the helper set. #### Return Value | | | | --- | --- | | [HelperSet](../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance | ### [Application](../../console/application "Symfony\Component\Console\Application") getApplication() Gets the application instance for this command. #### Return Value | | | | --- | --- | | [Application](../../console/application "Symfony\Component\Console\Application") | An Application instance | ### bool isEnabled() Checks whether the command is enabled or not in the current environment. Override this to check for x or y and return false if the command can not run properly under the current conditions. #### Return Value | | | | --- | --- | | bool | | ### protected configure() Configures the current command. ### protected int|null execute([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Executes the current command. This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method. #### Parameters | | | | | --- | --- | --- | | [InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | | | [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | #### Return Value | | | | --- | --- | | int|null | null or 0 if everything went fine, or an error code | #### Exceptions | | | | --- | --- | | [LogicException](../../console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | When this abstract method is not implemented | ### protected interact([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Interacts with the user. This method is executed before the InputDefinition is validated. This means that this is the only place where the command can interactively ask for values of missing required arguments. #### Parameters | | | | | --- | --- | --- | | [InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | | | [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | ### protected initialize([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Initializes the command after the input has been bound and before the input is validated. This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options. #### Parameters | | | | | --- | --- | --- | | [InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | | | [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | #### See also | | | | --- | --- | | [InputInterface::bind](../../console/input/inputinterface#method_bind "Symfony\Component\Console\Input\InputInterface") | | | [InputInterface::validate](../../console/input/inputinterface#method_validate "Symfony\Component\Console\Input\InputInterface") | | ### int run([InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") $input, [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output) Runs the command. The code to execute is either defined directly with the setCode() method or by overriding the execute() method in a sub-class. #### Parameters | | | | | --- | --- | --- | | [InputInterface](../../console/input/inputinterface "Symfony\Component\Console\Input\InputInterface") | $input | | | [OutputInterface](../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | #### Return Value | | | | --- | --- | | int | The command exit code | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. | #### See also | | | | --- | --- | | setCode() | | | execute() | | ### $this setCode(callable $code) Sets the code to execute when running this command. If this method is used, it overrides the code defined in the execute() method. #### Parameters | | | | | --- | --- | --- | | callable | $code | A callable(InputInterface $input, OutputInterface $output) | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | | #### See also | | | | --- | --- | | execute() | | ### mergeApplicationDefinition(bool $mergeArgs = true) Merges the application definition with the command definition. This method is not part of public API and should not be used directly. #### Parameters | | | | | --- | --- | --- | | bool | $mergeArgs | Whether to merge or not the Application definition arguments to Command definition arguments | ### $this setDefinition(array|[InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") $definition) Sets an array of argument and option instances. #### Parameters | | | | | --- | --- | --- | | array|[InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | $definition | An array of argument and option instances or a definition instance | #### Return Value | | | | --- | --- | | $this | | ### [InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") getDefinition() Gets the InputDefinition attached to this Command. #### Return Value | | | | --- | --- | | [InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance | ### [InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") getNativeDefinition() Gets the InputDefinition to be used to create representations of this Command. Can be overridden to provide the original command representation when it would otherwise be changed by merging with the application InputDefinition. This method is not part of public API and should not be used directly. #### Return Value | | | | --- | --- | | [InputDefinition](../../console/input/inputdefinition "Symfony\Component\Console\Input\InputDefinition") | An InputDefinition instance | ### $this addArgument(string $name, int|null $mode = null, string $description = '', string|string[]|null $default = null) Adds an argument. #### Parameters | | | | | --- | --- | --- | | string | $name | The argument name | | int|null | $mode | The argument mode: self::REQUIRED or self::OPTIONAL | | string | $description | A description text | | string|string[]|null | $default | The default value (for self::OPTIONAL mode only) | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When argument mode is not valid | ### $this addOption(string $name, string|array $shortcut = null, int|null $mode = null, string $description = '', string|string[]|bool|null $default = null) Adds an option. #### Parameters | | | | | --- | --- | --- | | string | $name | The option name | | string|array | $shortcut | The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts | | int|null | $mode | The option mode: One of the VALUE\_\* constants | | string | $description | A description text | | string|string[]|bool|null | $default | The default value (must be null for self::VALUE\_NONE) | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | If option mode is invalid or incompatible | ### $this setName(string $name) Sets the name of the command. This method can set both the namespace and the name if you separate them by a colon (:) ``` $command->setName('foo:bar'); ``` #### Parameters | | | | | --- | --- | --- | | string | $name | The command name | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When the name is invalid | ### $this setProcessTitle(string $title) Sets the process title of the command. This feature should be used only when creating a long process command, like a daemon. PHP 5.5+ or the proctitle PECL library is required #### Parameters | | | | | --- | --- | --- | | string | $title | The process title | #### Return Value | | | | --- | --- | | $this | | ### string getName() Returns the command name. #### Return Value | | | | --- | --- | | string | The command name | ### [Command](../../console/command/command "Symfony\Component\Console\Command\Command") setHidden(bool $hidden) #### Parameters | | | | | --- | --- | --- | | bool | $hidden | Whether or not the command should be hidden from the list of commands | #### Return Value | | | | --- | --- | | [Command](../../console/command/command "Symfony\Component\Console\Command\Command") | The current instance | ### bool isHidden() #### Return Value | | | | --- | --- | | bool | whether the command should be publicly shown or not | ### $this setDescription(string $description) Sets the description for the command. #### Parameters | | | | | --- | --- | --- | | string | $description | The description for the command | #### Return Value | | | | --- | --- | | $this | | ### string getDescription() Returns the description for the command. #### Return Value | | | | --- | --- | | string | The description for the command | ### $this setHelp(string $help) Sets the help for the command. #### Parameters | | | | | --- | --- | --- | | string | $help | The help for the command | #### Return Value | | | | --- | --- | | $this | | ### string getHelp() Returns the help for the command. #### Return Value | | | | --- | --- | | string | The help for the command | ### string getProcessedHelp() Returns the processed help for the command replacing the %command.name% and %command.full\_name% patterns with the real values dynamically. #### Return Value | | | | --- | --- | | string | The processed help for the command | ### $this setAliases(string[] $aliases) Sets the aliases for the command. #### Parameters | | | | | --- | --- | --- | | string[] | $aliases | An array of aliases for the command | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | When an alias is invalid | ### array getAliases() Returns the aliases for the command. #### Return Value | | | | --- | --- | | array | An array of aliases for the command | ### string getSynopsis(bool $short = false) Returns the synopsis for the command. #### Parameters | | | | | --- | --- | --- | | bool | $short | Whether to show the short version of the synopsis (with options folded) or not | #### Return Value | | | | --- | --- | | string | The synopsis | ### $this addUsage(string $usage) Add a command usage example. #### Parameters | | | | | --- | --- | --- | | string | $usage | The usage, it'll be prefixed with the command name | #### Return Value | | | | --- | --- | | $this | | ### array getUsages() Returns alternative usages of the command. #### Return Value | | | | --- | --- | | array | | ### mixed getHelper(string $name) Gets a helper instance by name. #### Parameters | | | | | --- | --- | --- | | string | $name | The helper name | #### Return Value | | | | --- | --- | | mixed | The helper value | #### Exceptions | | | | --- | --- | | [LogicException](../../console/exception/logicexception "Symfony\Component\Console\Exception\LogicException") | if no HelperSet is defined | | [InvalidArgumentException](../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | if the helper is not defined |
programming_docs
symfony FormPass FormPass ========= class **FormPass** implements [CompilerPassInterface](../../dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface") Adds all services with the tags "form.type", "form.type\_extension" and "form.type\_guesser" as arguments of the "form.extension" service. Traits ------ | | | | --- | --- | | [PriorityTaggedServiceTrait](../../dependencyinjection/compiler/prioritytaggedservicetrait "Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait") | Trait that allows a generic method to find and sort service by priority option in the tag. | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $formExtensionService = 'form.extension', string $formTypeTag = 'form.type', string $formTypeExtensionTag = 'form.type\_extension', string $formTypeGuesserTag = 'form.type\_guesser', string $formDebugCommandService = 'console.command.form\_debug') | | | | [process](#method_process)([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | | Details ------- ### \_\_construct(string $formExtensionService = 'form.extension', string $formTypeTag = 'form.type', string $formTypeExtensionTag = 'form.type\_extension', string $formTypeGuesserTag = 'form.type\_guesser', string $formDebugCommandService = 'console.command.form\_debug') #### Parameters | | | | | --- | --- | --- | | string | $formExtensionService | | | string | $formTypeTag | | | string | $formTypeExtensionTag | | | string | $formTypeGuesserTag | | | string | $formDebugCommandService | | ### process([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. #### Parameters | | | | | --- | --- | --- | | [ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | | symfony InvalidConfigurationException InvalidConfigurationException ============================== class **InvalidConfigurationException** extends [InvalidArgumentException](invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") symfony InvalidArgumentException InvalidArgumentException ========================= class **InvalidArgumentException** extends [InvalidArgumentException](http://php.net/InvalidArgumentException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Form\Exception\ExceptionInterface") Base InvalidArgumentException for the Form component. symfony ExceptionInterface ExceptionInterface =================== interface **ExceptionInterface** Base ExceptionInterface for the Form component. symfony LogicException LogicException =============== class **LogicException** extends [LogicException](http://php.net/LogicException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Form\Exception\ExceptionInterface") Base LogicException for Form component. symfony StringCastException StringCastException ==================== class **StringCastException** extends [RuntimeException](runtimeexception "Symfony\Component\Form\Exception\RuntimeException") symfony RuntimeException RuntimeException ================= class **RuntimeException** extends [RuntimeException](http://php.net/RuntimeException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Form\Exception\ExceptionInterface") Base RuntimeException for the Form component. symfony OutOfBoundsException OutOfBoundsException ===================== class **OutOfBoundsException** extends [OutOfBoundsException](http://php.net/OutOfBoundsException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Form\Exception\ExceptionInterface") Base OutOfBoundsException for Form component. symfony BadMethodCallException BadMethodCallException ======================= class **BadMethodCallException** extends [BadMethodCallException](http://php.net/BadMethodCallException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Form\Exception\ExceptionInterface") Base BadMethodCallException for the Form component. symfony AlreadySubmittedException AlreadySubmittedException ========================== class **AlreadySubmittedException** extends [LogicException](logicexception "Symfony\Component\Form\Exception\LogicException") Thrown when an operation is called that is not acceptable after submitting a form. symfony UnexpectedTypeException UnexpectedTypeException ======================== class **UnexpectedTypeException** extends [InvalidArgumentException](invalidargumentexception "Symfony\Component\Form\Exception\InvalidArgumentException") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)($value, string $expectedType) | | Details ------- ### \_\_construct($value, string $expectedType) #### Parameters | | | | | --- | --- | --- | | | $value | | | string | $expectedType | | symfony ErrorMappingException ErrorMappingException ====================== class **ErrorMappingException** extends [RuntimeException](runtimeexception "Symfony\Component\Form\Exception\RuntimeException") symfony TransformationFailedException TransformationFailedException ============================== class **TransformationFailedException** extends [RuntimeException](runtimeexception "Symfony\Component\Form\Exception\RuntimeException") Indicates a value transformation error. symfony Symfony\Component\Form\Console\Descriptor Symfony\Component\Form\Console\Descriptor ========================================= Classes ------- | | | | --- | --- | | [Descriptor](descriptor/descriptor "Symfony\Component\Form\Console\Descriptor\Descriptor") | | | [JsonDescriptor](descriptor/jsondescriptor "Symfony\Component\Form\Console\Descriptor\JsonDescriptor") | | | [TextDescriptor](descriptor/textdescriptor "Symfony\Component\Form\Console\Descriptor\TextDescriptor") | | symfony Symfony\Component\Form\Console\Helper Symfony\Component\Form\Console\Helper ===================================== Classes ------- | | | | --- | --- | | [DescriptorHelper](helper/descriptorhelper "Symfony\Component\Form\Console\Helper\DescriptorHelper") | | symfony Descriptor Descriptor =========== abstract class **Descriptor** implements [DescriptorInterface](../../../console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") Properties ---------- | | | | | | --- | --- | --- | --- | | protected [OutputStyle](../../../console/style/outputstyle "Symfony\Component\Console\Style\OutputStyle") | $output | | | | protected | $type | | | | protected | $ownOptions | | | | protected | $overriddenOptions | | | | protected | $parentOptions | | | | protected | $extensionOptions | | | | protected | $requiredOptions | | | | protected | $parents | | | | protected | $extensions | | | Methods ------- | | | | | --- | --- | --- | | | [describe](#method_describe)([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | | | | [describeDefaults](#method_describeDefaults)(array $options) | | | | [describeResolvedFormType](#method_describeResolvedFormType)([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $resolvedFormType, array $options = array()) | | | | [describeOption](#method_describeOption)([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, array $options) | | | | [collectOptions](#method_collectOptions)([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) | | | | [getOptionDefinition](#method_getOptionDefinition)([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, $option) | | Details ------- ### describe([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. #### Parameters | | | | | --- | --- | --- | | [OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | | object | $object | | | array | $options | | ### abstract protected describeDefaults(array $options) #### Parameters | | | | | --- | --- | --- | | array | $options | | ### abstract protected describeResolvedFormType([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $resolvedFormType, array $options = array()) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $resolvedFormType | | | array | $options | | ### abstract protected describeOption([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, array $options) #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $optionsResolver | | | array | $options | | ### protected collectOptions([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | ### protected getOptionDefinition([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, $option) #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $optionsResolver | | | | $option | | symfony JsonDescriptor JsonDescriptor =============== class **JsonDescriptor** extends [Descriptor](descriptor "Symfony\Component\Form\Console\Descriptor\Descriptor") Properties ---------- | | | | | | --- | --- | --- | --- | | protected [OutputStyle](../../../console/style/outputstyle "Symfony\Component\Console\Style\OutputStyle") | $output | | from [Descriptor](descriptor#property_output "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $type | | from [Descriptor](descriptor#property_type "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $ownOptions | | from [Descriptor](descriptor#property_ownOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $overriddenOptions | | from [Descriptor](descriptor#property_overriddenOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $parentOptions | | from [Descriptor](descriptor#property_parentOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $extensionOptions | | from [Descriptor](descriptor#property_extensionOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $requiredOptions | | from [Descriptor](descriptor#property_requiredOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $parents | | from [Descriptor](descriptor#property_parents "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $extensions | | from [Descriptor](descriptor#property_extensions "Symfony\Component\Form\Console\Descriptor\Descriptor") | Methods ------- | | | | | --- | --- | --- | | | [describe](#method_describe)([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [Descriptor](descriptor#method_describe "Symfony\Component\Form\Console\Descriptor\Descriptor") | | | [describeDefaults](#method_describeDefaults)(array $options) | | | | [describeResolvedFormType](#method_describeResolvedFormType)([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $resolvedFormType, array $options = array()) | | | | [describeOption](#method_describeOption)([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, array $options) | | | | [collectOptions](#method_collectOptions)([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) | from [Descriptor](descriptor#method_collectOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | | [getOptionDefinition](#method_getOptionDefinition)([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, $option) | from [Descriptor](descriptor#method_getOptionDefinition "Symfony\Component\Form\Console\Descriptor\Descriptor") | Details ------- ### describe([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. #### Parameters | | | | | --- | --- | --- | | [OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | | object | $object | | | array | $options | | ### protected describeDefaults(array $options) #### Parameters | | | | | --- | --- | --- | | array | $options | | ### protected describeResolvedFormType([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $resolvedFormType, array $options = array()) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $resolvedFormType | | | array | $options | | ### protected describeOption([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, array $options) #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $optionsResolver | | | array | $options | | ### protected collectOptions([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | ### protected getOptionDefinition([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, $option) #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $optionsResolver | | | | $option | | symfony TextDescriptor TextDescriptor =============== class **TextDescriptor** extends [Descriptor](descriptor "Symfony\Component\Form\Console\Descriptor\Descriptor") Properties ---------- | | | | | | --- | --- | --- | --- | | protected [OutputStyle](../../../console/style/outputstyle "Symfony\Component\Console\Style\OutputStyle") | $output | | from [Descriptor](descriptor#property_output "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $type | | from [Descriptor](descriptor#property_type "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $ownOptions | | from [Descriptor](descriptor#property_ownOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $overriddenOptions | | from [Descriptor](descriptor#property_overriddenOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $parentOptions | | from [Descriptor](descriptor#property_parentOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $extensionOptions | | from [Descriptor](descriptor#property_extensionOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $requiredOptions | | from [Descriptor](descriptor#property_requiredOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $parents | | from [Descriptor](descriptor#property_parents "Symfony\Component\Form\Console\Descriptor\Descriptor") | | protected | $extensions | | from [Descriptor](descriptor#property_extensions "Symfony\Component\Form\Console\Descriptor\Descriptor") | Methods ------- | | | | | --- | --- | --- | | | [describe](#method_describe)([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [Descriptor](descriptor#method_describe "Symfony\Component\Form\Console\Descriptor\Descriptor") | | | [describeDefaults](#method_describeDefaults)(array $options) | | | | [describeResolvedFormType](#method_describeResolvedFormType)([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $resolvedFormType, array $options = array()) | | | | [describeOption](#method_describeOption)([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, array $options) | | | | [collectOptions](#method_collectOptions)([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) | from [Descriptor](descriptor#method_collectOptions "Symfony\Component\Form\Console\Descriptor\Descriptor") | | | [getOptionDefinition](#method_getOptionDefinition)([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, $option) | from [Descriptor](descriptor#method_getOptionDefinition "Symfony\Component\Form\Console\Descriptor\Descriptor") | Details ------- ### describe([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. #### Parameters | | | | | --- | --- | --- | | [OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | | object | $object | | | array | $options | | ### protected describeDefaults(array $options) #### Parameters | | | | | --- | --- | --- | | array | $options | | ### protected describeResolvedFormType([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $resolvedFormType, array $options = array()) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $resolvedFormType | | | array | $options | | ### protected describeOption([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, array $options) #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $optionsResolver | | | array | $options | | ### protected collectOptions([ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") $type) #### Parameters | | | | | --- | --- | --- | | [ResolvedFormTypeInterface](../../resolvedformtypeinterface "Symfony\Component\Form\ResolvedFormTypeInterface") | $type | | ### protected getOptionDefinition([OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") $optionsResolver, $option) #### Parameters | | | | | --- | --- | --- | | [OptionsResolver](../../../optionsresolver/optionsresolver "Symfony\Component\OptionsResolver\OptionsResolver") | $optionsResolver | | | | $option | |
programming_docs
symfony DescriptorHelper DescriptorHelper ================= class **DescriptorHelper** extends [DescriptorHelper](../../../console/helper/descriptorhelper "Symfony\Component\Console\Helper\DescriptorHelper") Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $helperSet | | from [Helper](../../../console/helper/helper#property_helperSet "Symfony\Component\Console\Helper\Helper") | Methods ------- | | | | | --- | --- | --- | | | [setHelperSet](#method_setHelperSet)([HelperSet](../../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet = null) Sets the helper set associated with this helper. | from [Helper](../../../console/helper/helper#method_setHelperSet "Symfony\Component\Console\Helper\Helper") | | [HelperSet](../../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | [getHelperSet](#method_getHelperSet)() Gets the helper set associated with this helper. | from [Helper](../../../console/helper/helper#method_getHelperSet "Symfony\Component\Console\Helper\Helper") | | static int | [strlen](#method_strlen)(string $string) Returns the length of a string, using mb\_strwidth if it is available. | from [Helper](../../../console/helper/helper#method_strlen "Symfony\Component\Console\Helper\Helper") | | static string | [substr](#method_substr)(string $string, int $from, int|null $length = null) Returns the subset of a string, using mb\_substr if it is available. | from [Helper](../../../console/helper/helper#method_substr "Symfony\Component\Console\Helper\Helper") | | static | [formatTime](#method_formatTime)($secs) | from [Helper](../../../console/helper/helper#method_formatTime "Symfony\Component\Console\Helper\Helper") | | static | [formatMemory](#method_formatMemory)($memory) | from [Helper](../../../console/helper/helper#method_formatMemory "Symfony\Component\Console\Helper\Helper") | | static | [strlenWithoutDecoration](#method_strlenWithoutDecoration)([OutputFormatterInterface](../../../console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string) | from [Helper](../../../console/helper/helper#method_strlenWithoutDecoration "Symfony\Component\Console\Helper\Helper") | | static | [removeDecoration](#method_removeDecoration)([OutputFormatterInterface](../../../console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string) | from [Helper](../../../console/helper/helper#method_removeDecoration "Symfony\Component\Console\Helper\Helper") | | | [\_\_construct](#method___construct)() | | | | [describe](#method_describe)([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. | from [DescriptorHelper](../../../console/helper/descriptorhelper#method_describe "Symfony\Component\Console\Helper\DescriptorHelper") | | $this | [register](#method_register)(string $format, [DescriptorInterface](../../../console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") $descriptor) Registers a descriptor. | from [DescriptorHelper](../../../console/helper/descriptorhelper#method_register "Symfony\Component\Console\Helper\DescriptorHelper") | | string | [getName](#method_getName)() Returns the canonical name of this helper. | from [DescriptorHelper](../../../console/helper/descriptorhelper#method_getName "Symfony\Component\Console\Helper\DescriptorHelper") | Details ------- ### setHelperSet([HelperSet](../../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") $helperSet = null) Sets the helper set associated with this helper. #### Parameters | | | | | --- | --- | --- | | [HelperSet](../../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | $helperSet | | ### [HelperSet](../../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") getHelperSet() Gets the helper set associated with this helper. #### Return Value | | | | --- | --- | | [HelperSet](../../../console/helper/helperset "Symfony\Component\Console\Helper\HelperSet") | A HelperSet instance | ### static int strlen(string $string) Returns the length of a string, using mb\_strwidth if it is available. #### Parameters | | | | | --- | --- | --- | | string | $string | The string to check its length | #### Return Value | | | | --- | --- | | int | The length of the string | ### static string substr(string $string, int $from, int|null $length = null) Returns the subset of a string, using mb\_substr if it is available. #### Parameters | | | | | --- | --- | --- | | string | $string | String to subset | | int | $from | Start offset | | int|null | $length | Length to read | #### Return Value | | | | --- | --- | | string | The string subset | ### static formatTime($secs) #### Parameters | | | | | --- | --- | --- | | | $secs | | ### static formatMemory($memory) #### Parameters | | | | | --- | --- | --- | | | $memory | | ### static strlenWithoutDecoration([OutputFormatterInterface](../../../console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string) #### Parameters | | | | | --- | --- | --- | | [OutputFormatterInterface](../../../console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") | $formatter | | | | $string | | ### static removeDecoration([OutputFormatterInterface](../../../console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") $formatter, $string) #### Parameters | | | | | --- | --- | --- | | [OutputFormatterInterface](../../../console/formatter/outputformatterinterface "Symfony\Component\Console\Formatter\OutputFormatterInterface") | $formatter | | | | $string | | ### \_\_construct() ### describe([OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") $output, object $object, array $options = array()) Describes an object if supported. Available options are: \* format: string, the output format name \* raw\_text: boolean, sets output type as raw #### Parameters | | | | | --- | --- | --- | | [OutputInterface](../../../console/output/outputinterface "Symfony\Component\Console\Output\OutputInterface") | $output | | | object | $object | | | array | $options | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../../console/exception/invalidargumentexception "Symfony\Component\Console\Exception\InvalidArgumentException") | when the given format is not supported | ### $this register(string $format, [DescriptorInterface](../../../console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") $descriptor) Registers a descriptor. #### Parameters | | | | | --- | --- | --- | | string | $format | | | [DescriptorInterface](../../../console/descriptor/descriptorinterface "Symfony\Component\Console\Descriptor\DescriptorInterface") | $descriptor | | #### Return Value | | | | --- | --- | | $this | | ### string getName() Returns the canonical name of this helper. #### Return Value | | | | --- | --- | | string | The canonical name | symfony SerializerAwareInterface SerializerAwareInterface ========================= interface **SerializerAwareInterface** Defines the interface of encoders. Methods ------- | | | | | --- | --- | --- | | | [setSerializer](#method_setSerializer)([SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the owning Serializer object. | | Details ------- ### setSerializer([SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the owning Serializer object. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | symfony Symfony\Component\Serializer\Exception Symfony\Component\Serializer\Exception ====================================== Classes ------- | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | | | [CircularReferenceException](exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | CircularReferenceException. | | [ExtraAttributesException](exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | ExtraAttributesException. | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | InvalidArgumentException. | | [LogicException](exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | LogicException. | | [MappingException](exception/mappingexception "Symfony\Component\Serializer\Exception\MappingException") | MappingException. | | [MissingConstructorArgumentsException](exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | | [NotEncodableValueException](exception/notencodablevalueexception "Symfony\Component\Serializer\Exception\NotEncodableValueException") | | | [NotNormalizableValueException](exception/notnormalizablevalueexception "Symfony\Component\Serializer\Exception\NotNormalizableValueException") | | | [RuntimeException](exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | RuntimeException. | | [UnexpectedValueException](exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | UnexpectedValueException. | | [UnsupportedException](exception/unsupportedexception "Symfony\Component\Serializer\Exception\UnsupportedException") | UnsupportedException. | Interfaces ---------- | | | | --- | --- | | *[ExceptionInterface](exception/exceptioninterface "Symfony\Component\Serializer\Exception\ExceptionInterface")* | Base exception interface. | symfony Symfony\Component\Serializer\NameConverter Symfony\Component\Serializer\NameConverter ========================================== Classes ------- | | | | --- | --- | | [CamelCaseToSnakeCaseNameConverter](nameconverter/camelcasetosnakecasenameconverter "Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter") | CamelCase to Underscore name converter. | Interfaces ---------- | | | | --- | --- | | *[NameConverterInterface](nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")* | Defines the interface for property name converters. | symfony SerializerInterface SerializerInterface ==================== interface **SerializerInterface** Defines the interface of the Serializer. Methods ------- | | | | | --- | --- | --- | | string | [serialize](#method_serialize)(mixed $data, string $format, array $context = array()) Serializes data in the appropriate format. | | | object | [deserialize](#method_deserialize)(mixed $data, string $type, string $format, array $context = array()) Deserializes data into the given type. | | Details ------- ### string serialize(mixed $data, string $format, array $context = array()) Serializes data in the appropriate format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Any data | | string | $format | Format name | | array | $context | Options normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string | | ### object deserialize(mixed $data, string $type, string $format, array $context = array()) Deserializes data into the given type. #### Parameters | | | | | --- | --- | --- | | mixed | $data | | | string | $type | | | string | $format | | | array | $context | | #### Return Value | | | | --- | --- | | object | | symfony SerializerAwareTrait SerializerAwareTrait ===================== trait **SerializerAwareTrait** SerializerAware trait. Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | | Methods ------- | | | | | --- | --- | --- | | | [setSerializer](#method_setSerializer)([SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | | Details ------- ### setSerializer([SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | symfony Symfony\Component\Serializer\Mapping Symfony\Component\Serializer\Mapping ==================================== Namespaces ---------- [Symfony\Component\Serializer\Mapping\Factory](mapping/factory)[Symfony\Component\Serializer\Mapping\Loader](mapping/loader) Classes ------- | | | | --- | --- | | [AttributeMetadata](mapping/attributemetadata "Symfony\Component\Serializer\Mapping\AttributeMetadata") | {@inheritdoc} | | [ClassDiscriminatorFromClassMetadata](mapping/classdiscriminatorfromclassmetadata "Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata") | | | [ClassDiscriminatorMapping](mapping/classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") | | | [ClassMetadata](mapping/classmetadata "Symfony\Component\Serializer\Mapping\ClassMetadata") | {@inheritdoc} | Interfaces ---------- | | | | --- | --- | | *[AttributeMetadataInterface](mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")* | Stores metadata needed for serializing and deserializing attributes. | | *[ClassDiscriminatorResolverInterface](mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface")* | Knows how to get the class discriminator mapping for classes and objects. | | *[ClassMetadataInterface](mapping/classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface")* | Stores metadata needed for serializing and deserializing objects of specific class. | symfony Symfony\Component\Serializer\Normalizer Symfony\Component\Serializer\Normalizer ======================================= Classes ------- | | | | --- | --- | | [AbstractNormalizer](normalizer/abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | Normalizer implementation. | | [AbstractObjectNormalizer](normalizer/abstractobjectnormalizer "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | Base class for a normalizer dealing with objects. | | [ArrayDenormalizer](normalizer/arraydenormalizer "Symfony\Component\Serializer\Normalizer\ArrayDenormalizer") | Denormalizes arrays of objects. | | [ConstraintViolationListNormalizer](normalizer/constraintviolationlistnormalizer "Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer") | A normalizer that normalizes a ConstraintViolationListInterface instance. | | [CustomNormalizer](normalizer/customnormalizer "Symfony\Component\Serializer\Normalizer\CustomNormalizer") | | | [DataUriNormalizer](normalizer/dataurinormalizer "Symfony\Component\Serializer\Normalizer\DataUriNormalizer") | Normalizes an {see \SplFileInfo} object to a data URI. | | [DateIntervalNormalizer](normalizer/dateintervalnormalizer "Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer") | Normalizes an instance of {see \DateInterval} to an interval string. | | [DateTimeNormalizer](normalizer/datetimenormalizer "Symfony\Component\Serializer\Normalizer\DateTimeNormalizer") | Normalizes an object implementing the {see \DateTimeInterface} to a date string. | | [DenormalizerAwareTrait](normalizer/denormalizerawaretrait "Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait") | DenormalizerAware trait. | | [GetSetMethodNormalizer](normalizer/getsetmethodnormalizer "Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer") | Converts between objects with getter and setter methods and arrays. | | [JsonSerializableNormalizer](normalizer/jsonserializablenormalizer "Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer") | A normalizer that uses an objects own JsonSerializable implementation. | | [NormalizerAwareTrait](normalizer/normalizerawaretrait "Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait") | NormalizerAware trait. | | [ObjectNormalizer](normalizer/objectnormalizer "Symfony\Component\Serializer\Normalizer\ObjectNormalizer") | Converts between objects and arrays using the PropertyAccess component. | | [ObjectToPopulateTrait](normalizer/objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [PropertyNormalizer](normalizer/propertynormalizer "Symfony\Component\Serializer\Normalizer\PropertyNormalizer") | Converts between objects and arrays by mapping properties. | Interfaces ---------- | | | | --- | --- | | *[CacheableSupportsMethodInterface](normalizer/cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface")* | Marker interface for normalizers and denormalizers that use only the type and the format in their supports\*() methods. | | *[ContextAwareDenormalizerInterface](normalizer/contextawaredenormalizerinterface "Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface")* | Adds the support of an extra $context parameter for the supportsDenormalization method. | | *[ContextAwareNormalizerInterface](normalizer/contextawarenormalizerinterface "Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface")* | Adds the support of an extra $context parameter for the supportsNormalization method. | | *[DenormalizableInterface](normalizer/denormalizableinterface "Symfony\Component\Serializer\Normalizer\DenormalizableInterface")* | Defines the most basic interface a class must implement to be denormalizable. | | *[DenormalizerAwareInterface](normalizer/denormalizerawareinterface "Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface")* | Class accepting a denormalizer. | | *[DenormalizerInterface](normalizer/denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface")* | Defines the interface of denormalizers. | | *[NormalizableInterface](normalizer/normalizableinterface "Symfony\Component\Serializer\Normalizer\NormalizableInterface")* | Defines the most basic interface a class must implement to be normalizable. | | *[NormalizerAwareInterface](normalizer/normalizerawareinterface "Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface")* | Class accepting a normalizer. | | *[NormalizerInterface](normalizer/normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface")* | Defines the interface of normalizers. | symfony Symfony\Component\Serializer\DependencyInjection Symfony\Component\Serializer\DependencyInjection ================================================ Classes ------- | | | | --- | --- | | [SerializerPass](dependencyinjection/serializerpass "Symfony\Component\Serializer\DependencyInjection\SerializerPass") | Adds all services with the tags "serializer.encoder" and "serializer.normalizer" as encoders and normalizers to the "serializer" service. |
programming_docs
symfony Serializer Serializer =========== class **Serializer** implements [SerializerInterface](serializerinterface "Symfony\Component\Serializer\SerializerInterface"), [ContextAwareNormalizerInterface](normalizer/contextawarenormalizerinterface "Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface"), [ContextAwareDenormalizerInterface](normalizer/contextawaredenormalizerinterface "Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface"), [ContextAwareEncoderInterface](encoder/contextawareencoderinterface "Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface"), [ContextAwareDecoderInterface](encoder/contextawaredecoderinterface "Symfony\Component\Serializer\Encoder\ContextAwareDecoderInterface") Serializer serializes and deserializes data. objects are turned into arrays by normalizers. arrays are turned into various output formats by encoders. ``` $serializer->serialize($obj, 'xml') $serializer->decode($data, 'xml') $serializer->denormalize($data, 'Class', 'xml') ``` Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ChainEncoder](encoder/chainencoder "Symfony\Component\Serializer\Encoder\ChainEncoder") | $encoder | | | | protected [ChainDecoder](encoder/chaindecoder "Symfony\Component\Serializer\Encoder\ChainDecoder") | $decoder | | | | protected | $normalizers | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $normalizers = array(), array $encoders = array()) | | | string | [serialize](#method_serialize)(mixed $data, string $format, array $context = array()) Serializes data in the appropriate format. | | | object | [deserialize](#method_deserialize)(mixed $data, string $type, string $format, array $context = array()) Deserializes data into the given type. | | | array|string|int|float|bool | [normalize](#method_normalize)($data, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | object | [denormalize](#method_denormalize)(mixed $data, $type, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null, array $context = array()) Checks whether the given class is supported for normalization by this normalizer. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null, array $context = array()) Checks whether the given class is supported for denormalization by this normalizer. | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format, array $context = array()) Checks whether the serializer can encode to given format. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format, array $context = array()) Checks whether the deserializer can decode from given format. | | Details ------- ### \_\_construct(array $normalizers = array(), array $encoders = array()) #### Parameters | | | | | --- | --- | --- | | array | $normalizers | | | array | $encoders | | ### final string serialize(mixed $data, string $format, array $context = array()) Serializes data in the appropriate format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Any data | | string | $format | Format name | | array | $context | Options normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string | | ### final object deserialize(mixed $data, string $type, string $format, array $context = array()) Deserializes data into the given type. #### Parameters | | | | | --- | --- | --- | | mixed | $data | | | string | $type | | | string | $format | | | array | $context | | #### Return Value | | | | --- | --- | | object | | ### array|string|int|float|bool normalize($data, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | | $data | | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### object denormalize(mixed $data, $type, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | | $type | | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsNormalization(mixed $data, string $format = null, array $context = array()) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null, array $context = array()) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### final string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### final mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format, array $context = array()) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### bool supportsDecoding(string $format, array $context = array()) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | | array | $context | | #### Return Value | | | | --- | --- | | bool | | symfony Symfony\Component\Serializer\Encoder Symfony\Component\Serializer\Encoder ==================================== Classes ------- | | | | --- | --- | | [ChainDecoder](encoder/chaindecoder "Symfony\Component\Serializer\Encoder\ChainDecoder") | Decoder delegating the decoding to a chain of decoders. | | [ChainEncoder](encoder/chainencoder "Symfony\Component\Serializer\Encoder\ChainEncoder") | Encoder delegating the decoding to a chain of encoders. | | [CsvEncoder](encoder/csvencoder "Symfony\Component\Serializer\Encoder\CsvEncoder") | Encodes CSV data. | | [JsonDecode](encoder/jsondecode "Symfony\Component\Serializer\Encoder\JsonDecode") | Decodes JSON data. | | [JsonEncode](encoder/jsonencode "Symfony\Component\Serializer\Encoder\JsonEncode") | Encodes JSON data. | | [JsonEncoder](encoder/jsonencoder "Symfony\Component\Serializer\Encoder\JsonEncoder") | Encodes JSON data. | | [XmlEncoder](encoder/xmlencoder "Symfony\Component\Serializer\Encoder\XmlEncoder") | Encodes XML data. | | [YamlEncoder](encoder/yamlencoder "Symfony\Component\Serializer\Encoder\YamlEncoder") | Encodes YAML data. | Interfaces ---------- | | | | --- | --- | | *[ContextAwareDecoderInterface](encoder/contextawaredecoderinterface "Symfony\Component\Serializer\Encoder\ContextAwareDecoderInterface")* | Adds the support of an extra $context parameter for the supportsDecoding method. | | *[ContextAwareEncoderInterface](encoder/contextawareencoderinterface "Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface")* | Adds the support of an extra $context parameter for the supportsEncoding method. | | *[DecoderInterface](encoder/decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface")* | Defines the interface of decoders. | | *[EncoderInterface](encoder/encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface")* | Defines the interface of encoders. | | *[NormalizationAwareInterface](encoder/normalizationawareinterface "Symfony\Component\Serializer\Encoder\NormalizationAwareInterface")* | Defines the interface of encoders that will normalize data themselves. | symfony Symfony\Component\Serializer\Annotation Symfony\Component\Serializer\Annotation ======================================= Classes ------- | | | | --- | --- | | [DiscriminatorMap](annotation/discriminatormap "Symfony\Component\Serializer\Annotation\DiscriminatorMap") | Annotation class for @DiscriminatorMap(). | | [Groups](annotation/groups "Symfony\Component\Serializer\Annotation\Groups") | Annotation class for @Groups(). | | [MaxDepth](annotation/maxdepth "Symfony\Component\Serializer\Annotation\MaxDepth") | Annotation class for @MaxDepth(). | symfony Symfony\Component\Serializer\Mapping\Loader Symfony\Component\Serializer\Mapping\Loader =========================================== Classes ------- | | | | --- | --- | | [AnnotationLoader](loader/annotationloader "Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader") | Annotation loader. | | [FileLoader](loader/fileloader "Symfony\Component\Serializer\Mapping\Loader\FileLoader") | Base class for all file based loaders. | | [LoaderChain](loader/loaderchain "Symfony\Component\Serializer\Mapping\Loader\LoaderChain") | Calls multiple {@link LoaderInterface} instances in a chain. | | [XmlFileLoader](loader/xmlfileloader "Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader") | Loads XML mapping files. | | [YamlFileLoader](loader/yamlfileloader "Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader") | YAML File Loader. | Interfaces ---------- | | | | --- | --- | | *[LoaderInterface](loader/loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface")* | Loads {@link ClassMetadataInterface}. | symfony Symfony\Component\Serializer\Mapping\Factory Symfony\Component\Serializer\Mapping\Factory ============================================ Classes ------- | | | | --- | --- | | [CacheClassMetadataFactory](factory/cacheclassmetadatafactory "Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory") | Caches metadata using a PSR-6 implementation. | | [ClassMetadataFactory](factory/classmetadatafactory "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory") | Returns a {@link ClassMetadata}. | | [ClassResolverTrait](factory/classresolvertrait "Symfony\Component\Serializer\Mapping\Factory\ClassResolverTrait") | Resolves a class name. | Interfaces ---------- | | | | --- | --- | | *[ClassMetadataFactoryInterface](factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")* | Returns a {see ClassMetadataInterface}. | symfony ClassDiscriminatorFromClassMetadata ClassDiscriminatorFromClassMetadata ==================================== class **ClassDiscriminatorFromClassMetadata** implements [ClassDiscriminatorResolverInterface](classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory) | | | ClassDiscriminatorMapping|null | [getMappingForClass](#method_getMappingForClass)(string $class) | | | ClassDiscriminatorMapping|null | [getMappingForMappedObject](#method_getMappingForMappedObject)(object|string $object) | | | string|null | [getTypeForMappedObject](#method_getTypeForMappedObject)(object|string $object) | | Details ------- ### \_\_construct([ClassMetadataFactoryInterface](factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | ### ClassDiscriminatorMapping|null getMappingForClass(string $class) #### Parameters | | | | | --- | --- | --- | | string | $class | | #### Return Value | | | | --- | --- | | ClassDiscriminatorMapping|null | | ### ClassDiscriminatorMapping|null getMappingForMappedObject(object|string $object) #### Parameters | | | | | --- | --- | --- | | object|string | $object | | #### Return Value | | | | --- | --- | | ClassDiscriminatorMapping|null | | ### string|null getTypeForMappedObject(object|string $object) #### Parameters | | | | | --- | --- | --- | | object|string | $object | | #### Return Value | | | | --- | --- | | string|null | | symfony ClassMetadataInterface ClassMetadataInterface ======================= interface **ClassMetadataInterface** Stores metadata needed for serializing and deserializing objects of specific class. Primarily, the metadata stores the set of attributes to serialize or deserialize. There may only exist one metadata for each attribute according to its name. Methods ------- | | | | | --- | --- | --- | | string | [getName](#method_getName)() Returns the name of the backing PHP class. | | | | [addAttributeMetadata](#method_addAttributeMetadata)([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Adds an {@link AttributeMetadataInterface}. | | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] | [getAttributesMetadata](#method_getAttributesMetadata)() Gets the list of {@link AttributeMetadataInterface}. | | | | [merge](#method_merge)([ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) Merges a {@link ClassMetadataInterface} in the current one. | | | [ReflectionClass](http://php.net/ReflectionClass) | [getReflectionClass](#method_getReflectionClass)() Returns a {@link \ReflectionClass} instance for this class. | | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null | [getClassDiscriminatorMapping](#method_getClassDiscriminatorMapping)() | | | | [setClassDiscriminatorMapping](#method_setClassDiscriminatorMapping)([ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") $mapping = null) | | Details ------- ### string getName() Returns the name of the backing PHP class. #### Return Value | | | | --- | --- | | string | The name of the backing class | ### addAttributeMetadata([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Adds an {@link AttributeMetadataInterface}. #### Parameters | | | | | --- | --- | --- | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") | $attributeMetadata | | ### [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] getAttributesMetadata() Gets the list of {@link AttributeMetadataInterface}. #### Return Value | | | | --- | --- | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] | | ### merge([ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) Merges a {@link ClassMetadataInterface} in the current one. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $classMetadata | | ### [ReflectionClass](http://php.net/ReflectionClass) getReflectionClass() Returns a {@link \ReflectionClass} instance for this class. #### Return Value | | | | --- | --- | | [ReflectionClass](http://php.net/ReflectionClass) | | ### [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null getClassDiscriminatorMapping() #### Return Value | | | | --- | --- | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null | | ### setClassDiscriminatorMapping([ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") $mapping = null) #### Parameters | | | | | --- | --- | --- | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") | $mapping | |
programming_docs
symfony ClassMetadata ClassMetadata ============== class **ClassMetadata** implements [ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") {@inheritdoc} Properties ---------- | | | | | | --- | --- | --- | --- | | | $name | | | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] | $attributesMetadata | | | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null | $classDiscriminatorMapping | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $class, [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") $classDiscriminatorMapping = null) Constructs a metadata for the given class. | | | string | [getName](#method_getName)() Returns the name of the backing PHP class. | | | | [addAttributeMetadata](#method_addAttributeMetadata)([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Adds an {@link AttributeMetadataInterface}. | | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] | [getAttributesMetadata](#method_getAttributesMetadata)() Gets the list of {@link AttributeMetadataInterface}. | | | | [merge](#method_merge)([ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) Merges a {@link ClassMetadataInterface} in the current one. | | | [ReflectionClass](http://php.net/ReflectionClass) | [getReflectionClass](#method_getReflectionClass)() Returns a {@link \ReflectionClass} instance for this class. | | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null | [getClassDiscriminatorMapping](#method_getClassDiscriminatorMapping)() | | | | [setClassDiscriminatorMapping](#method_setClassDiscriminatorMapping)([ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") $mapping = null) | | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | | Details ------- ### \_\_construct(string $class, [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") $classDiscriminatorMapping = null) Constructs a metadata for the given class. #### Parameters | | | | | --- | --- | --- | | string | $class | | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") | $classDiscriminatorMapping | | ### string getName() Returns the name of the backing PHP class. #### Return Value | | | | --- | --- | | string | The name of the backing class | ### addAttributeMetadata([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Adds an {@link AttributeMetadataInterface}. #### Parameters | | | | | --- | --- | --- | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") | $attributeMetadata | | ### [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] getAttributesMetadata() Gets the list of {@link AttributeMetadataInterface}. #### Return Value | | | | --- | --- | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[] | | ### merge([ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) Merges a {@link ClassMetadataInterface} in the current one. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $classMetadata | | ### [ReflectionClass](http://php.net/ReflectionClass) getReflectionClass() Returns a {@link \ReflectionClass} instance for this class. #### Return Value | | | | --- | --- | | [ReflectionClass](http://php.net/ReflectionClass) | | ### [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null getClassDiscriminatorMapping() #### Return Value | | | | --- | --- | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping")|null | | ### setClassDiscriminatorMapping([ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") $mapping = null) #### Parameters | | | | | --- | --- | --- | | [ClassDiscriminatorMapping](classdiscriminatormapping "Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping") | $mapping | | ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | symfony AttributeMetadataInterface AttributeMetadataInterface =========================== interface **AttributeMetadataInterface** Stores metadata needed for serializing and deserializing attributes. Primarily, the metadata stores serialization groups. Methods ------- | | | | | --- | --- | --- | | string | [getName](#method_getName)() Gets the attribute name. | | | | [addGroup](#method_addGroup)(string $group) Adds this attribute to the given group. | | | string[] | [getGroups](#method_getGroups)() Gets groups of this attribute. | | | | [setMaxDepth](#method_setMaxDepth)(int|null $maxDepth) Sets the serialization max depth for this attribute. | | | int|null | [getMaxDepth](#method_getMaxDepth)() Gets the serialization max depth for this attribute. | | | | [merge](#method_merge)([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Merges an {see AttributeMetadataInterface} with in the current one. | | Details ------- ### string getName() Gets the attribute name. #### Return Value | | | | --- | --- | | string | | ### addGroup(string $group) Adds this attribute to the given group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string[] getGroups() Gets groups of this attribute. #### Return Value | | | | --- | --- | | string[] | | ### setMaxDepth(int|null $maxDepth) Sets the serialization max depth for this attribute. #### Parameters | | | | | --- | --- | --- | | int|null | $maxDepth | | ### int|null getMaxDepth() Gets the serialization max depth for this attribute. #### Return Value | | | | --- | --- | | int|null | | ### merge([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Merges an {see AttributeMetadataInterface} with in the current one. #### Parameters | | | | | --- | --- | --- | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") | $attributeMetadata | | symfony ClassDiscriminatorMapping ClassDiscriminatorMapping ========================== class **ClassDiscriminatorMapping** Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $typeProperty, array $typesMapping = array()) | | | string | [getTypeProperty](#method_getTypeProperty)() | | | string|null | [getClassForType](#method_getClassForType)(string $type) | | | string|null | [getMappedObjectType](#method_getMappedObjectType)(object|string $object) | | | array | [getTypesMapping](#method_getTypesMapping)() | | Details ------- ### \_\_construct(string $typeProperty, array $typesMapping = array()) #### Parameters | | | | | --- | --- | --- | | string | $typeProperty | | | array | $typesMapping | | ### string getTypeProperty() #### Return Value | | | | --- | --- | | string | | ### string|null getClassForType(string $type) #### Parameters | | | | | --- | --- | --- | | string | $type | | #### Return Value | | | | --- | --- | | string|null | | ### string|null getMappedObjectType(object|string $object) #### Parameters | | | | | --- | --- | --- | | object|string | $object | | #### Return Value | | | | --- | --- | | string|null | | ### array getTypesMapping() #### Return Value | | | | --- | --- | | array | | symfony AttributeMetadata AttributeMetadata ================== class **AttributeMetadata** implements [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") {@inheritdoc} Properties ---------- | | | | | | --- | --- | --- | --- | | | $name | | | | | $groups | | | | int|null | $maxDepth | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $name) | | | string | [getName](#method_getName)() Gets the attribute name. | | | | [addGroup](#method_addGroup)(string $group) Adds this attribute to the given group. | | | string[] | [getGroups](#method_getGroups)() Gets groups of this attribute. | | | | [setMaxDepth](#method_setMaxDepth)(int|null $maxDepth) Sets the serialization max depth for this attribute. | | | int|null | [getMaxDepth](#method_getMaxDepth)() Gets the serialization max depth for this attribute. | | | | [merge](#method_merge)([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Merges an {see AttributeMetadataInterface} with in the current one. | | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | | Details ------- ### \_\_construct(string $name) #### Parameters | | | | | --- | --- | --- | | string | $name | | ### string getName() Gets the attribute name. #### Return Value | | | | --- | --- | | string | | ### addGroup(string $group) Adds this attribute to the given group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string[] getGroups() Gets groups of this attribute. #### Return Value | | | | --- | --- | | string[] | | ### setMaxDepth(int|null $maxDepth) Sets the serialization max depth for this attribute. #### Parameters | | | | | --- | --- | --- | | int|null | $maxDepth | | ### int|null getMaxDepth() Gets the serialization max depth for this attribute. #### Return Value | | | | --- | --- | | int|null | | ### merge([AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") $attributeMetadata) Merges an {see AttributeMetadataInterface} with in the current one. #### Parameters | | | | | --- | --- | --- | | [AttributeMetadataInterface](attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface") | $attributeMetadata | | ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | symfony ClassDiscriminatorResolverInterface ClassDiscriminatorResolverInterface ==================================== interface **ClassDiscriminatorResolverInterface** Knows how to get the class discriminator mapping for classes and objects. Methods ------- | | | | | --- | --- | --- | | ClassDiscriminatorMapping|null | [getMappingForClass](#method_getMappingForClass)(string $class) | | | ClassDiscriminatorMapping|null | [getMappingForMappedObject](#method_getMappingForMappedObject)(object|string $object) | | | string|null | [getTypeForMappedObject](#method_getTypeForMappedObject)(object|string $object) | | Details ------- ### ClassDiscriminatorMapping|null getMappingForClass(string $class) #### Parameters | | | | | --- | --- | --- | | string | $class | | #### Return Value | | | | --- | --- | | ClassDiscriminatorMapping|null | | ### ClassDiscriminatorMapping|null getMappingForMappedObject(object|string $object) #### Parameters | | | | | --- | --- | --- | | object|string | $object | | #### Return Value | | | | --- | --- | | ClassDiscriminatorMapping|null | | ### string|null getTypeForMappedObject(object|string $object) #### Parameters | | | | | --- | --- | --- | | object|string | $object | | #### Return Value | | | | --- | --- | | string|null | | symfony FileLoader FileLoader =========== abstract class **FileLoader** implements [LoaderInterface](loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface") Base class for all file based loaders. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $file | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $file) | | Details ------- ### \_\_construct(string $file) #### Parameters | | | | | --- | --- | --- | | string | $file | The mapping file to load | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Serializer\Exception\MappingException") | if the mapping file does not exist or is not readable | symfony AnnotationLoader AnnotationLoader ================= class **AnnotationLoader** implements [LoaderInterface](loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface") Annotation loader. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(Reader $reader) | | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) | | Details ------- ### \_\_construct(Reader $reader) #### Parameters | | | | | --- | --- | --- | | Reader | $reader | | ### bool loadClassMetadata([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $classMetadata | | #### Return Value | | | | --- | --- | | bool | | symfony YamlFileLoader YamlFileLoader =============== class **YamlFileLoader** extends [FileLoader](fileloader "Symfony\Component\Serializer\Mapping\Loader\FileLoader") YAML File Loader. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $file | | from [FileLoader](fileloader#property_file "Symfony\Component\Serializer\Mapping\Loader\FileLoader") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $file) | from [FileLoader](fileloader#method___construct "Symfony\Component\Serializer\Mapping\Loader\FileLoader") | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) | | | string[] | [getMappedClasses](#method_getMappedClasses)() Return the names of the classes mapped in this file. | | Details ------- ### \_\_construct(string $file) #### Parameters | | | | | --- | --- | --- | | string | $file | The mapping file to load | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Serializer\Exception\MappingException") | if the mapping file does not exist or is not readable | ### bool loadClassMetadata([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $classMetadata | | #### Return Value | | | | --- | --- | | bool | | ### string[] getMappedClasses() Return the names of the classes mapped in this file. #### Return Value | | | | --- | --- | | string[] | The classes names | symfony LoaderInterface LoaderInterface ================ interface **LoaderInterface** Loads {@link ClassMetadataInterface}. Methods ------- | | | | | --- | --- | --- | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) | | Details ------- ### bool loadClassMetadata([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $classMetadata | | #### Return Value | | | | --- | --- | | bool | | symfony LoaderChain LoaderChain ============ class **LoaderChain** implements [LoaderInterface](loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface") Calls multiple {@link LoaderInterface} instances in a chain. This class accepts multiple instances of LoaderInterface to be passed to the constructor. When {@link loadClassMetadata()} is called, the same method is called in *all* of these loaders, regardless of whether any of them was successful or not. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $loaders) Accepts a list of LoaderInterface instances. | | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $metadata) | | | [LoaderInterface](loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface")[] | [getLoaders](#method_getLoaders)() | | Details ------- ### \_\_construct(array $loaders) Accepts a list of LoaderInterface instances. #### Parameters | | | | | --- | --- | --- | | array | $loaders | An array of LoaderInterface instances | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Serializer\Exception\MappingException") | If any of the loaders does not implement LoaderInterface | ### bool loadClassMetadata([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $metadata) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $metadata | | #### Return Value | | | | --- | --- | | bool | | ### [LoaderInterface](loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface")[] getLoaders() #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface")[] | | symfony XmlFileLoader XmlFileLoader ============== class **XmlFileLoader** extends [FileLoader](fileloader "Symfony\Component\Serializer\Mapping\Loader\FileLoader") Loads XML mapping files. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $file | | from [FileLoader](fileloader#property_file "Symfony\Component\Serializer\Mapping\Loader\FileLoader") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $file) | from [FileLoader](fileloader#method___construct "Symfony\Component\Serializer\Mapping\Loader\FileLoader") | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) | | | string[] | [getMappedClasses](#method_getMappedClasses)() Return the names of the classes mapped in this file. | | Details ------- ### \_\_construct(string $file) #### Parameters | | | | | --- | --- | --- | | string | $file | The mapping file to load | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Serializer\Exception\MappingException") | if the mapping file does not exist or is not readable | ### bool loadClassMetadata([ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") $classMetadata) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | $classMetadata | | #### Return Value | | | | --- | --- | | bool | | ### string[] getMappedClasses() Return the names of the classes mapped in this file. #### Return Value | | | | --- | --- | | string[] | The classes names |
programming_docs
symfony ClassResolverTrait ClassResolverTrait =================== trait **ClassResolverTrait** Resolves a class name. symfony ClassMetadataFactoryInterface ClassMetadataFactoryInterface ============================== interface **ClassMetadataFactoryInterface** Returns a {see ClassMetadataInterface}. Methods ------- | | | | | --- | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | [getMetadataFor](#method_getMetadataFor)(string|object $value) If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Checks if class has metadata. | | Details ------- ### [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") getMetadataFor(string|object $value) If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned. If the factory was configured with a cache, this method will first look for an existing metadata instance in the cache. If an existing instance is found, it will be returned without further ado. Otherwise, a new metadata instance is created. If the factory was configured with a loader, the metadata is passed to the {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further configuration. At last, the new object is returned. #### Parameters | | | | | --- | --- | --- | | string|object | $value | | #### Return Value | | | | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | | ### bool hasMetadataFor(mixed $value) Checks if class has metadata. #### Parameters | | | | | --- | --- | --- | | mixed | $value | | #### Return Value | | | | --- | --- | | bool | | symfony ClassMetadataFactory ClassMetadataFactory ===================== class **ClassMetadataFactory** implements [ClassMetadataFactoryInterface](classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") Returns a {@link ClassMetadata}. Traits ------ | | | | --- | --- | | [ClassResolverTrait](classresolvertrait "Symfony\Component\Serializer\Mapping\Factory\ClassResolverTrait") | Resolves a class name. | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([LoaderInterface](../loader/loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface") $loader) | | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | [getMetadataFor](#method_getMetadataFor)(string|object $value) If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Checks if class has metadata. | | Details ------- ### \_\_construct([LoaderInterface](../loader/loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface") $loader) #### Parameters | | | | | --- | --- | --- | | [LoaderInterface](../loader/loaderinterface "Symfony\Component\Serializer\Mapping\Loader\LoaderInterface") | $loader | | ### [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") getMetadataFor(string|object $value) If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned. If the factory was configured with a cache, this method will first look for an existing metadata instance in the cache. If an existing instance is found, it will be returned without further ado. Otherwise, a new metadata instance is created. If the factory was configured with a loader, the metadata is passed to the {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further configuration. At last, the new object is returned. #### Parameters | | | | | --- | --- | --- | | string|object | $value | | #### Return Value | | | | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | | ### bool hasMetadataFor(mixed $value) Checks if class has metadata. #### Parameters | | | | | --- | --- | --- | | mixed | $value | | #### Return Value | | | | --- | --- | | bool | | symfony CacheClassMetadataFactory CacheClassMetadataFactory ========================== class **CacheClassMetadataFactory** implements [ClassMetadataFactoryInterface](classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") Caches metadata using a PSR-6 implementation. Traits ------ | | | | --- | --- | | [ClassResolverTrait](classresolvertrait "Symfony\Component\Serializer\Mapping\Factory\ClassResolverTrait") | Resolves a class name. | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $decorated, CacheItemPoolInterface $cacheItemPool) | | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | [getMetadataFor](#method_getMetadataFor)(string|object $value) If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Checks if class has metadata. | | Details ------- ### \_\_construct([ClassMetadataFactoryInterface](classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $decorated, CacheItemPoolInterface $cacheItemPool) #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $decorated | | | CacheItemPoolInterface | $cacheItemPool | | ### [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") getMetadataFor(string|object $value) If the method was called with the same class name (or an object of that class) before, the same metadata instance is returned. If the factory was configured with a cache, this method will first look for an existing metadata instance in the cache. If an existing instance is found, it will be returned without further ado. Otherwise, a new metadata instance is created. If the factory was configured with a loader, the metadata is passed to the {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further configuration. At last, the new object is returned. #### Parameters | | | | | --- | --- | --- | | string|object | $value | | #### Return Value | | | | --- | --- | | [ClassMetadataInterface](../classmetadatainterface "Symfony\Component\Serializer\Mapping\ClassMetadataInterface") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | | ### bool hasMetadataFor(mixed $value) Checks if class has metadata. #### Parameters | | | | | --- | --- | --- | | mixed | $value | | #### Return Value | | | | --- | --- | | bool | | symfony NormalizationAwareInterface NormalizationAwareInterface ============================ interface **NormalizationAwareInterface** Defines the interface of encoders that will normalize data themselves. Implementing this interface essentially just tells the Serializer that the data should not be pre-normalized before being passed to this Encoder. symfony YamlEncoder YamlEncoder ============ class **YamlEncoder** implements [EncoderInterface](encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface"), [DecoderInterface](decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface") Encodes YAML data. Constants --------- | | | | --- | --- | | FORMAT | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([Dumper](../../yaml/dumper "Symfony\Component\Yaml\Dumper") $dumper = null, [Parser](../../yaml/parser "Symfony\Component\Yaml\Parser") $parser = null, array $defaultContext = array()) | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format) Checks whether the serializer can encode to given format. | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format) Checks whether the deserializer can decode from given format. | | Details ------- ### \_\_construct([Dumper](../../yaml/dumper "Symfony\Component\Yaml\Dumper") $dumper = null, [Parser](../../yaml/parser "Symfony\Component\Yaml\Parser") $parser = null, array $defaultContext = array()) #### Parameters | | | | | --- | --- | --- | | [Dumper](../../yaml/dumper "Symfony\Component\Yaml\Dumper") | $dumper | | | [Parser](../../yaml/parser "Symfony\Component\Yaml\Parser") | $parser | | | array | $defaultContext | | ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | ### mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsDecoding(string $format) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony CsvEncoder CsvEncoder =========== class **CsvEncoder** implements [EncoderInterface](encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface"), [DecoderInterface](decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface") Encodes CSV data. Constants --------- | | | | --- | --- | | FORMAT | | | DELIMITER\_KEY | | | ENCLOSURE\_KEY | | | ESCAPE\_CHAR\_KEY | | | KEY\_SEPARATOR\_KEY | | | HEADERS\_KEY | | | ESCAPE\_FORMULAS\_KEY | | | AS\_COLLECTION\_KEY | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $delimiter = ',', string $enclosure = '"', string $escapeChar = '\\', string $keySeparator = '.', bool $escapeFormulas = false) | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format) Checks whether the serializer can encode to given format. | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format) Checks whether the deserializer can decode from given format. | | Details ------- ### \_\_construct(string $delimiter = ',', string $enclosure = '"', string $escapeChar = '\\', string $keySeparator = '.', bool $escapeFormulas = false) #### Parameters | | | | | --- | --- | --- | | string | $delimiter | | | string | $enclosure | | | string | $escapeChar | | | string | $keySeparator | | | bool | $escapeFormulas | | ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | ### mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsDecoding(string $format) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony JsonEncode JsonEncode =========== class **JsonEncode** implements [EncoderInterface](encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface") Encodes JSON data. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(int $bitmask = 0) | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes PHP data to a JSON string. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format) Checks whether the serializer can encode to given format. | | Details ------- ### \_\_construct(int $bitmask = 0) #### Parameters | | | | | --- | --- | --- | | int | $bitmask | | ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes PHP data to a JSON string. {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | ### bool supportsEncoding(string $format) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony DecoderInterface DecoderInterface ================= interface **DecoderInterface** Defines the interface of decoders. Methods ------- | | | | | --- | --- | --- | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format) Checks whether the deserializer can decode from given format. | | Details ------- ### mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsDecoding(string $format) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony EncoderInterface EncoderInterface ================= interface **EncoderInterface** Defines the interface of encoders. Methods ------- | | | | | --- | --- | --- | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format) Checks whether the serializer can encode to given format. | | Details ------- ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony ChainEncoder ChainEncoder ============= class **ChainEncoder** implements [ContextAwareEncoderInterface](contextawareencoderinterface "Symfony\Component\Serializer\Encoder\ContextAwareEncoderInterface") Encoder delegating the decoding to a chain of encoders. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $encoders | | | | protected | $encoderByFormat | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $encoders = array()) | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format, array $context = array()) Checks whether the serializer can encode to given format. | | | bool | [needsNormalization](#method_needsNormalization)(string $format, array $context = array()) Checks whether the normalization is needed for the given format. | | Details ------- ### \_\_construct(array $encoders = array()) #### Parameters | | | | | --- | --- | --- | | array | $encoders | | ### final string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format, array $context = array()) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### bool needsNormalization(string $format, array $context = array()) Checks whether the normalization is needed for the given format. #### Parameters | | | | | --- | --- | --- | | string | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | |
programming_docs
symfony JsonDecode JsonDecode =========== class **JsonDecode** implements [DecoderInterface](decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface") Decodes JSON data. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $serializer | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(bool $associative = false, int $depth = 512) Constructs a new JsonDecode instance. | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes data. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format) Checks whether the deserializer can decode from given format. | | Details ------- ### \_\_construct(bool $associative = false, int $depth = 512) Constructs a new JsonDecode instance. #### Parameters | | | | | --- | --- | --- | | bool | $associative | True to return the result associative array, false for a nested stdClass hierarchy | | int | $depth | Specifies the recursion depth | ### mixed decode(string $data, string $format, array $context = array()) Decodes data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [NotEncodableValueException](../exception/notencodablevalueexception "Symfony\Component\Serializer\Exception\NotEncodableValueException") | | #### See also | | | | --- | --- | | <http://php.net/json_decode> | json\_decode | ### bool supportsDecoding(string $format) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony XmlEncoder XmlEncoder =========== class **XmlEncoder** implements [EncoderInterface](encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface"), [DecoderInterface](decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface"), [NormalizationAwareInterface](normalizationawareinterface "Symfony\Component\Serializer\Encoder\NormalizationAwareInterface"), [SerializerAwareInterface](../serializerawareinterface "Symfony\Component\Serializer\SerializerAwareInterface") Encodes XML data. Traits ------ | | | | --- | --- | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | FORMAT | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | Methods ------- | | | | | --- | --- | --- | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)(string $rootNodeName = 'response', int $loadOptions = null, array $ignoredNodeTypes = array(XML\_PI\_NODE, XML\_COMMENT\_NODE)) Construct new XmlEncoder and allow to change the root node element name. | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format) Checks whether the serializer can encode to given format. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format) Checks whether the deserializer can decode from given format. | | | | [setRootNodeName](#method_setRootNodeName)(string $name) Sets the root node name. | | | string | [getRootNodeName](#method_getRootNodeName)() Returns the root node name. | | | bool | [appendXMLString](#method_appendXMLString)([DOMNode](http://php.net/DOMNode) $node, string $val) | | | bool | [appendText](#method_appendText)([DOMNode](http://php.net/DOMNode) $node, string $val) | | | bool | [appendCData](#method_appendCData)([DOMNode](http://php.net/DOMNode) $node, string $val) | | | bool | [appendDocumentFragment](#method_appendDocumentFragment)([DOMNode](http://php.net/DOMNode) $node, [DOMDocumentFragment](http://php.net/DOMDocumentFragment) $fragment) | | | bool | [isElementNameValid](#method_isElementNameValid)(string $name) Checks the name is a valid xml element name. | | Details ------- ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct(string $rootNodeName = 'response', int $loadOptions = null, array $ignoredNodeTypes = array(XML\_PI\_NODE, XML\_COMMENT\_NODE)) Construct new XmlEncoder and allow to change the root node element name. #### Parameters | | | | | --- | --- | --- | | string | $rootNodeName | | | int | $loadOptions | | | array | $ignoredNodeTypes | | ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | ### bool supportsDecoding(string $format) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | ### setRootNodeName(string $name) Sets the root node name. #### Parameters | | | | | --- | --- | --- | | string | $name | Root node name | ### string getRootNodeName() Returns the root node name. #### Return Value | | | | --- | --- | | string | | ### final protected bool appendXMLString([DOMNode](http://php.net/DOMNode) $node, string $val) #### Parameters | | | | | --- | --- | --- | | [DOMNode](http://php.net/DOMNode) | $node | | | string | $val | | #### Return Value | | | | --- | --- | | bool | | ### final protected bool appendText([DOMNode](http://php.net/DOMNode) $node, string $val) #### Parameters | | | | | --- | --- | --- | | [DOMNode](http://php.net/DOMNode) | $node | | | string | $val | | #### Return Value | | | | --- | --- | | bool | | ### final protected bool appendCData([DOMNode](http://php.net/DOMNode) $node, string $val) #### Parameters | | | | | --- | --- | --- | | [DOMNode](http://php.net/DOMNode) | $node | | | string | $val | | #### Return Value | | | | --- | --- | | bool | | ### final protected bool appendDocumentFragment([DOMNode](http://php.net/DOMNode) $node, [DOMDocumentFragment](http://php.net/DOMDocumentFragment) $fragment) #### Parameters | | | | | --- | --- | --- | | [DOMNode](http://php.net/DOMNode) | $node | | | [DOMDocumentFragment](http://php.net/DOMDocumentFragment) | $fragment | | #### Return Value | | | | --- | --- | | bool | | ### final protected bool isElementNameValid(string $name) Checks the name is a valid xml element name. #### Parameters | | | | | --- | --- | --- | | string | $name | | #### Return Value | | | | --- | --- | | bool | | symfony ContextAwareDecoderInterface ContextAwareDecoderInterface ============================= interface **ContextAwareDecoderInterface** implements [DecoderInterface](decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface") Adds the support of an extra $context parameter for the supportsDecoding method. Methods ------- | | | | | --- | --- | --- | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | from [DecoderInterface](decoderinterface#method_decode "Symfony\Component\Serializer\Encoder\DecoderInterface") | | bool | [supportsDecoding](#method_supportsDecoding)(string $format, array $context = array()) Checks whether the deserializer can decode from given format. | | Details ------- ### mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsDecoding(string $format, array $context = array()) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | | array | $context | | #### Return Value | | | | --- | --- | | bool | | symfony ChainDecoder ChainDecoder ============= class **ChainDecoder** implements [ContextAwareDecoderInterface](contextawaredecoderinterface "Symfony\Component\Serializer\Encoder\ContextAwareDecoderInterface") Decoder delegating the decoding to a chain of decoders. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $decoders | | | | protected | $decoderByFormat | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $decoders = array()) | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format, array $context = array()) Checks whether the deserializer can decode from given format. | | Details ------- ### \_\_construct(array $decoders = array()) #### Parameters | | | | | --- | --- | --- | | array | $decoders | | ### final mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsDecoding(string $format, array $context = array()) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | | array | $context | | #### Return Value | | | | --- | --- | | bool | | symfony ContextAwareEncoderInterface ContextAwareEncoderInterface ============================= interface **ContextAwareEncoderInterface** implements [EncoderInterface](encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface") Adds the support of an extra $context parameter for the supportsEncoding method. Methods ------- | | | | | --- | --- | --- | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | from [EncoderInterface](encoderinterface#method_encode "Symfony\Component\Serializer\Encoder\EncoderInterface") | | bool | [supportsEncoding](#method_supportsEncoding)(string $format, array $context = array()) Checks whether the serializer can encode to given format. | | Details ------- ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format, array $context = array()) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | | array | $context | | #### Return Value | | | | --- | --- | | bool | | symfony JsonEncoder JsonEncoder ============ class **JsonEncoder** implements [EncoderInterface](encoderinterface "Symfony\Component\Serializer\Encoder\EncoderInterface"), [DecoderInterface](decoderinterface "Symfony\Component\Serializer\Encoder\DecoderInterface") Encodes JSON data. Constants --------- | | | | --- | --- | | FORMAT | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $encodingImpl | | | | protected | $decodingImpl | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([JsonEncode](jsonencode "Symfony\Component\Serializer\Encoder\JsonEncode") $encodingImpl = null, [JsonDecode](jsondecode "Symfony\Component\Serializer\Encoder\JsonDecode") $decodingImpl = null) | | | string|int|float|bool | [encode](#method_encode)(mixed $data, string $format, array $context = array()) Encodes data into the given format. | | | mixed | [decode](#method_decode)(string $data, string $format, array $context = array()) Decodes a string into PHP data. | | | bool | [supportsEncoding](#method_supportsEncoding)(string $format) Checks whether the serializer can encode to given format. | | | bool | [supportsDecoding](#method_supportsDecoding)(string $format) Checks whether the deserializer can decode from given format. | | Details ------- ### \_\_construct([JsonEncode](jsonencode "Symfony\Component\Serializer\Encoder\JsonEncode") $encodingImpl = null, [JsonDecode](jsondecode "Symfony\Component\Serializer\Encoder\JsonDecode") $decodingImpl = null) #### Parameters | | | | | --- | --- | --- | | [JsonEncode](jsonencode "Symfony\Component\Serializer\Encoder\JsonEncode") | $encodingImpl | | | [JsonDecode](jsondecode "Symfony\Component\Serializer\Encoder\JsonDecode") | $decodingImpl | | ### string|int|float|bool encode(mixed $data, string $format, array $context = array()) Encodes data into the given format. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to encode | | string | $format | Format name | | array | $context | Options that normalizers/encoders have access to | #### Return Value | | | | --- | --- | | string|int|float|bool | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### mixed decode(string $data, string $format, array $context = array()) Decodes a string into PHP data. #### Parameters | | | | | --- | --- | --- | | string | $data | Data to decode | | string | $format | Format name | | array | $context | Options that decoders have access to The format parameter specifies which format the data is in; valid values depend on the specific implementation. Authors implementing this interface are encouraged to document which formats they support in a non-inherited phpdoc comment. | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | | ### bool supportsEncoding(string $format) Checks whether the serializer can encode to given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | ### bool supportsDecoding(string $format) Checks whether the deserializer can decode from given format. #### Parameters | | | | | --- | --- | --- | | string | $format | Format name | #### Return Value | | | | --- | --- | | bool | | symfony Groups Groups ======= class **Groups** Annotation class for @Groups(). Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $data) | | | string[] | [getGroups](#method_getGroups)() Gets groups. | | Details ------- ### \_\_construct(array $data) #### Parameters | | | | | --- | --- | --- | | array | $data | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | | ### string[] getGroups() Gets groups. #### Return Value | | | | --- | --- | | string[] | | symfony DiscriminatorMap DiscriminatorMap ================= class **DiscriminatorMap** Annotation class for @DiscriminatorMap(). Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $data) | | | string | [getTypeProperty](#method_getTypeProperty)() | | | array | [getMapping](#method_getMapping)() | | Details ------- ### \_\_construct(array $data) #### Parameters | | | | | --- | --- | --- | | array | $data | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | | ### string getTypeProperty() #### Return Value | | | | --- | --- | | string | | ### array getMapping() #### Return Value | | | | --- | --- | | array | |
programming_docs
symfony MaxDepth MaxDepth ========= class **MaxDepth** Annotation class for @MaxDepth(). Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $data) | | | | [getMaxDepth](#method_getMaxDepth)() | | Details ------- ### \_\_construct(array $data) #### Parameters | | | | | --- | --- | --- | | array | $data | | ### getMaxDepth() symfony NameConverterInterface NameConverterInterface ======================= interface **NameConverterInterface** Defines the interface for property name converters. Methods ------- | | | | | --- | --- | --- | | string | [normalize](#method_normalize)(string $propertyName) Converts a property name to its normalized value. | | | string | [denormalize](#method_denormalize)(string $propertyName) Converts a property name to its denormalized value. | | Details ------- ### string normalize(string $propertyName) Converts a property name to its normalized value. #### Parameters | | | | | --- | --- | --- | | string | $propertyName | | #### Return Value | | | | --- | --- | | string | | ### string denormalize(string $propertyName) Converts a property name to its denormalized value. #### Parameters | | | | | --- | --- | --- | | string | $propertyName | | #### Return Value | | | | --- | --- | | string | | symfony CamelCaseToSnakeCaseNameConverter CamelCaseToSnakeCaseNameConverter ================================== class **CamelCaseToSnakeCaseNameConverter** implements [NameConverterInterface](nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") CamelCase to Underscore name converter. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $attributes = null, bool $lowerCamelCase = true) | | | string | [normalize](#method_normalize)(string $propertyName) Converts a property name to its normalized value. | | | string | [denormalize](#method_denormalize)(string $propertyName) Converts a property name to its denormalized value. | | Details ------- ### \_\_construct(array $attributes = null, bool $lowerCamelCase = true) #### Parameters | | | | | --- | --- | --- | | array | $attributes | The list of attributes to rename or null for all attributes | | bool | $lowerCamelCase | Use lowerCamelCase style | ### string normalize(string $propertyName) Converts a property name to its normalized value. #### Parameters | | | | | --- | --- | --- | | string | $propertyName | | #### Return Value | | | | --- | --- | | string | | ### string denormalize(string $propertyName) Converts a property name to its denormalized value. #### Parameters | | | | | --- | --- | --- | | string | $propertyName | | #### Return Value | | | | --- | --- | | string | | symfony GetSetMethodNormalizer GetSetMethodNormalizer ======================= class **GetSetMethodNormalizer** extends [AbstractObjectNormalizer](abstractobjectnormalizer "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") Converts between objects with getter and setter methods and arrays. The normalization process looks at all public methods and calls the ones which have a name starting with get and take no parameters. The result is a map from property names (method name stripped of the get prefix and converted to lower case) to property values. Property values are normalized through the serializer. The denormalization first looks at the constructor of the given class to see if any of the parameters have the same name as one of the properties. The constructor is then called with all parameters or an exception is thrown if any required parameters were not present as properties. Then the denormalizer walks through the given map of property names to property values to see if a setter method exists for any of the properties. If a setter exists it is called with the property value. No automatic denormalization of the value takes place. Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | CIRCULAR\_REFERENCE\_LIMIT | | | OBJECT\_TO\_POPULATE | | | GROUPS | | | ATTRIBUTES | | | ALLOW\_EXTRA\_ATTRIBUTES | | | DEFAULT\_CONSTRUCTOR\_ARGUMENTS | | | ENABLE\_MAX\_DEPTH | | | DEPTH\_KEY\_PATTERN | | | DISABLE\_TYPE\_ENFORCEMENT | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | | protected int | $circularReferenceLimit | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected callable | $circularReferenceHandler | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")|null | $classMetadataFactory | | from [AbstractNormalizer](abstractnormalizer#property_classMetadataFactory "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")|null | $nameConverter | | from [AbstractNormalizer](abstractnormalizer#property_nameConverter "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $callbacks | | from [AbstractNormalizer](abstractnormalizer#property_callbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $ignoredAttributes | | from [AbstractNormalizer](abstractnormalizer#property_ignoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $camelizedAttributes | | from [AbstractNormalizer](abstractnormalizer#property_camelizedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface")|null | $classDiscriminatorResolver | | from [AbstractObjectNormalizer](abstractobjectnormalizer#property_classDiscriminatorResolver "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method___construct "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceLimit](#method_setCircularReferenceLimit)(int $circularReferenceLimit) Set circular reference limit. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceHandler](#method_setCircularReferenceHandler)(callable $circularReferenceHandler) Set circular reference handler. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCallbacks](#method_setCallbacks)(array $callbacks) Set normalization callbacks. | from [AbstractNormalizer](abstractnormalizer#method_setCallbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setIgnoredAttributes](#method_setIgnoredAttributes)(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. | from [AbstractNormalizer](abstractnormalizer#method_setIgnoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | | bool | [isCircularReference](#method_isCircularReference)(object $object, array $context) Detects if the configured circular reference limit is reached. | from [AbstractNormalizer](abstractnormalizer#method_isCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | mixed | [handleCircularReference](#method_handleCircularReference)(object $object) Handles a circular reference. | from [AbstractNormalizer](abstractnormalizer#method_handleCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | [getAllowedAttributes](#method_getAllowedAttributes)(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. | from [AbstractNormalizer](abstractnormalizer#method_getAllowedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [isAllowedAttribute](#method_isAllowedAttribute)(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? | from [AbstractNormalizer](abstractnormalizer#method_isAllowedAttribute "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | array | [prepareForDenormalization](#method_prepareForDenormalization)(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. | from [AbstractNormalizer](abstractnormalizer#method_prepareForDenormalization "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | [getConstructor](#method_getConstructor)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. | from [AbstractNormalizer](abstractnormalizer#method_getConstructor "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | object | [instantiateObject](#method_instantiateObject)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_instantiateObject "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | array | [createChildContext](#method_createChildContext)(array $parentContext, string $attribute) | from [AbstractNormalizer](abstractnormalizer#method_createChildContext "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_normalize "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | string[] | [getAttributes](#method_getAttributes)(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_getAttributes "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | string[] | [extractAttributes](#method_extractAttributes)(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. | | | mixed | [getAttributeValue](#method_getAttributeValue)(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. | | | void | [setMaxDepthHandler](#method_setMaxDepthHandler)(callable|null $handler) Sets a handler function that will be called when the max depth is reached. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_setMaxDepthHandler "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_denormalize "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | | [setAttributeValue](#method_setAttributeValue)(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | | [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") | $nameConverter | | | [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") | $propertyTypeExtractor | | | [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") | $classDiscriminatorResolver | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceLimit(int $circularReferenceLimit) Set circular reference limit. #### Parameters | | | | | --- | --- | --- | | int | $circularReferenceLimit | Limit of iterations for the same object | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceHandler(callable $circularReferenceHandler) Set circular reference handler. #### Parameters | | | | | --- | --- | --- | | callable | $circularReferenceHandler | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCallbacks(array $callbacks) Set normalization callbacks. #### Parameters | | | | | --- | --- | --- | | array | $callbacks | Help normalize the result | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | if a non-callable callback is set | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setIgnoredAttributes(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. #### Parameters | | | | | --- | --- | --- | | array | $ignoredAttributes | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### protected bool isCircularReference(object $object, array $context) Detects if the configured circular reference limit is reached. #### Parameters | | | | | --- | --- | --- | | object | $object | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected mixed handleCircularReference(object $object) Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown. #### Parameters | | | | | --- | --- | --- | | object | $object | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. #### Parameters | | | | | --- | --- | --- | | string|object | $classOrObject | | | array | $context | | | bool | $attributesAsString | If false, return an array of {@link AttributeMetadataInterface} | #### Return Value | | | | --- | --- | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | if the 'allow\_extra\_attributes' context variable is false and no class metadata factory is provided | ### protected bool isAllowedAttribute(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? #### Parameters | | | | | --- | --- | --- | | object|string | $classOrObject | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### protected array prepareForDenormalization(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. #### Parameters | | | | | --- | --- | --- | | object|array | $data | | #### Return Value | | | | --- | --- | | array | | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|null getConstructor(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | | ### protected object instantiateObject(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if it is present in the context with the object\_to\_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | | string | $format | | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | | | [MissingConstructorArgumentsException](../exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | ### protected array createChildContext(array $parentContext, string $attribute) #### Parameters | | | | | --- | --- | --- | | array | $parentContext | | | string | $attribute | | #### Return Value | | | | --- | --- | | array | | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### protected string[] getAttributes(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### protected string[] extractAttributes(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### protected mixed getAttributeValue(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | mixed | | ### void setMaxDepthHandler(callable|null $handler) Sets a handler function that will be called when the max depth is reached. #### Parameters | | | | | --- | --- | --- | | callable|null | $handler | | #### Return Value | | | | --- | --- | | void | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### protected setAttributeValue(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | mixed | $value | | | string|null | $format | | | array | $context | |
programming_docs
symfony NormalizableInterface NormalizableInterface ====================== interface **NormalizableInterface** Defines the most basic interface a class must implement to be normalizable. If a normalizer is registered for the class and it doesn't implement the Normalizable interfaces, the normalizer will be used instead. Methods ------- | | | | | --- | --- | --- | | array|string|int|float|bool | [normalize](#method_normalize)([NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") $normalizer, string|null $format = null, array $context = array()) Normalizes the object into an array of scalars|arrays. | | Details ------- ### array|string|int|float|bool normalize([NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") $normalizer, string|null $format = null, array $context = array()) Normalizes the object into an array of scalars|arrays. It is important to understand that the normalize() call should normalize recursively all child objects of the implementor. #### Parameters | | | | | --- | --- | --- | | [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") | $normalizer | The normalizer is given so that you can use it to normalize objects contained within this object | | string|null | $format | The format is optionally given to be able to normalize differently based on different output formats | | array | $context | Options for normalizing this object | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | symfony DateTimeNormalizer DateTimeNormalizer =================== class **DateTimeNormalizer** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface"), [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") Normalizes an object implementing the {see \DateTimeInterface} to a date string. Denormalizes a date string to an instance of {see \DateTime} or {see \DateTimeImmutable}. Constants --------- | | | | --- | --- | | FORMAT\_KEY | | | TIMEZONE\_KEY | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|null $format = \DateTime::RFC3339, [DateTimeZone](http://php.net/DateTimeZone) $timezone = null) | | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | Details ------- ### \_\_construct(string|null $format = \DateTime::RFC3339, [DateTimeZone](http://php.net/DateTimeZone) $timezone = null) #### Parameters | | | | | --- | --- | --- | | string|null | $format | | | [DateTimeZone](http://php.net/DateTimeZone) | $timezone | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | symfony PropertyNormalizer PropertyNormalizer =================== class **PropertyNormalizer** extends [AbstractObjectNormalizer](abstractobjectnormalizer "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") Converts between objects and arrays by mapping properties. The normalization process looks for all the object's properties (public and private). The result is a map from property names to property values. Property values are normalized through the serializer. The denormalization first looks at the constructor of the given class to see if any of the parameters have the same name as one of the properties. The constructor is then called with all parameters or an exception is thrown if any required parameters were not present as properties. Then the denormalizer walks through the given map of property names to property values to see if a property with the corresponding name exists. If found, the property gets the value. Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | CIRCULAR\_REFERENCE\_LIMIT | | | OBJECT\_TO\_POPULATE | | | GROUPS | | | ATTRIBUTES | | | ALLOW\_EXTRA\_ATTRIBUTES | | | DEFAULT\_CONSTRUCTOR\_ARGUMENTS | | | ENABLE\_MAX\_DEPTH | | | DEPTH\_KEY\_PATTERN | | | DISABLE\_TYPE\_ENFORCEMENT | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | | protected int | $circularReferenceLimit | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected callable | $circularReferenceHandler | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")|null | $classMetadataFactory | | from [AbstractNormalizer](abstractnormalizer#property_classMetadataFactory "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")|null | $nameConverter | | from [AbstractNormalizer](abstractnormalizer#property_nameConverter "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $callbacks | | from [AbstractNormalizer](abstractnormalizer#property_callbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $ignoredAttributes | | from [AbstractNormalizer](abstractnormalizer#property_ignoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $camelizedAttributes | | from [AbstractNormalizer](abstractnormalizer#property_camelizedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface")|null | $classDiscriminatorResolver | | from [AbstractObjectNormalizer](abstractobjectnormalizer#property_classDiscriminatorResolver "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method___construct "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceLimit](#method_setCircularReferenceLimit)(int $circularReferenceLimit) Set circular reference limit. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceHandler](#method_setCircularReferenceHandler)(callable $circularReferenceHandler) Set circular reference handler. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCallbacks](#method_setCallbacks)(array $callbacks) Set normalization callbacks. | from [AbstractNormalizer](abstractnormalizer#method_setCallbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setIgnoredAttributes](#method_setIgnoredAttributes)(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. | from [AbstractNormalizer](abstractnormalizer#method_setIgnoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | | bool | [isCircularReference](#method_isCircularReference)(object $object, array $context) Detects if the configured circular reference limit is reached. | from [AbstractNormalizer](abstractnormalizer#method_isCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | mixed | [handleCircularReference](#method_handleCircularReference)(object $object) Handles a circular reference. | from [AbstractNormalizer](abstractnormalizer#method_handleCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | [getAllowedAttributes](#method_getAllowedAttributes)(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. | from [AbstractNormalizer](abstractnormalizer#method_getAllowedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [isAllowedAttribute](#method_isAllowedAttribute)(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? | | | array | [prepareForDenormalization](#method_prepareForDenormalization)(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. | from [AbstractNormalizer](abstractnormalizer#method_prepareForDenormalization "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | [getConstructor](#method_getConstructor)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. | from [AbstractNormalizer](abstractnormalizer#method_getConstructor "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | object | [instantiateObject](#method_instantiateObject)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_instantiateObject "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | array | [createChildContext](#method_createChildContext)(array $parentContext, string $attribute) | from [AbstractNormalizer](abstractnormalizer#method_createChildContext "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_normalize "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | string[] | [getAttributes](#method_getAttributes)(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_getAttributes "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | string[] | [extractAttributes](#method_extractAttributes)(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. | | | mixed | [getAttributeValue](#method_getAttributeValue)(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. | | | void | [setMaxDepthHandler](#method_setMaxDepthHandler)(callable|null $handler) Sets a handler function that will be called when the max depth is reached. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_setMaxDepthHandler "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_denormalize "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | | [setAttributeValue](#method_setAttributeValue)(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | | [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") | $nameConverter | | | [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") | $propertyTypeExtractor | | | [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") | $classDiscriminatorResolver | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceLimit(int $circularReferenceLimit) Set circular reference limit. #### Parameters | | | | | --- | --- | --- | | int | $circularReferenceLimit | Limit of iterations for the same object | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceHandler(callable $circularReferenceHandler) Set circular reference handler. #### Parameters | | | | | --- | --- | --- | | callable | $circularReferenceHandler | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCallbacks(array $callbacks) Set normalization callbacks. #### Parameters | | | | | --- | --- | --- | | array | $callbacks | Help normalize the result | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | if a non-callable callback is set | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setIgnoredAttributes(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. #### Parameters | | | | | --- | --- | --- | | array | $ignoredAttributes | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### protected bool isCircularReference(object $object, array $context) Detects if the configured circular reference limit is reached. #### Parameters | | | | | --- | --- | --- | | object | $object | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected mixed handleCircularReference(object $object) Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown. #### Parameters | | | | | --- | --- | --- | | object | $object | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. #### Parameters | | | | | --- | --- | --- | | string|object | $classOrObject | | | array | $context | | | bool | $attributesAsString | If false, return an array of {@link AttributeMetadataInterface} | #### Return Value | | | | --- | --- | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | if the 'allow\_extra\_attributes' context variable is false and no class metadata factory is provided | ### protected bool isAllowedAttribute(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? #### Parameters | | | | | --- | --- | --- | | object|string | $classOrObject | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### protected array prepareForDenormalization(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. #### Parameters | | | | | --- | --- | --- | | object|array | $data | | #### Return Value | | | | --- | --- | | array | | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|null getConstructor(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | | ### protected object instantiateObject(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if it is present in the context with the object\_to\_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | | string | $format | | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | | | [MissingConstructorArgumentsException](../exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | ### protected array createChildContext(array $parentContext, string $attribute) #### Parameters | | | | | --- | --- | --- | | array | $parentContext | | | string | $attribute | | #### Return Value | | | | --- | --- | | array | | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### protected string[] getAttributes(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### protected string[] extractAttributes(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### protected mixed getAttributeValue(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | mixed | | ### void setMaxDepthHandler(callable|null $handler) Sets a handler function that will be called when the max depth is reached. #### Parameters | | | | | --- | --- | --- | | callable|null | $handler | | #### Return Value | | | | --- | --- | | void | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### protected setAttributeValue(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | mixed | $value | | | string|null | $format | | | array | $context | |
programming_docs
symfony AbstractNormalizer AbstractNormalizer =================== abstract class **AbstractNormalizer** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface"), [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface"), [SerializerAwareInterface](../serializerawareinterface "Symfony\Component\Serializer\SerializerAwareInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") Normalizer implementation. Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | CIRCULAR\_REFERENCE\_LIMIT | | | OBJECT\_TO\_POPULATE | | | GROUPS | | | ATTRIBUTES | | | ALLOW\_EXTRA\_ATTRIBUTES | | | DEFAULT\_CONSTRUCTOR\_ARGUMENTS | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | | protected int | $circularReferenceLimit | | | | protected callable | $circularReferenceHandler | | | | protected [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")|null | $classMetadataFactory | | | | protected [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")|null | $nameConverter | | | | protected array | $callbacks | | | | protected array | $ignoredAttributes | | | | protected array | $camelizedAttributes | | | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null) Sets the {@link ClassMetadataFactoryInterface} to use. | | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceLimit](#method_setCircularReferenceLimit)(int $circularReferenceLimit) Set circular reference limit. | | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceHandler](#method_setCircularReferenceHandler)(callable $circularReferenceHandler) Set circular reference handler. | | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCallbacks](#method_setCallbacks)(array $callbacks) Set normalization callbacks. | | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setIgnoredAttributes](#method_setIgnoredAttributes)(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | | bool | [isCircularReference](#method_isCircularReference)(object $object, array $context) Detects if the configured circular reference limit is reached. | | | mixed | [handleCircularReference](#method_handleCircularReference)(object $object) Handles a circular reference. | | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | [getAllowedAttributes](#method_getAllowedAttributes)(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. | | | bool | [isAllowedAttribute](#method_isAllowedAttribute)(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? | | | array | [prepareForDenormalization](#method_prepareForDenormalization)(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. | | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | [getConstructor](#method_getConstructor)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. | | | object | [instantiateObject](#method_instantiateObject)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. | | | array | [createChildContext](#method_createChildContext)(array $parentContext, string $attribute) | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null) Sets the {@link ClassMetadataFactoryInterface} to use. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | | [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") | $nameConverter | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceLimit(int $circularReferenceLimit) Set circular reference limit. #### Parameters | | | | | --- | --- | --- | | int | $circularReferenceLimit | Limit of iterations for the same object | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceHandler(callable $circularReferenceHandler) Set circular reference handler. #### Parameters | | | | | --- | --- | --- | | callable | $circularReferenceHandler | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCallbacks(array $callbacks) Set normalization callbacks. #### Parameters | | | | | --- | --- | --- | | array | $callbacks | Help normalize the result | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | if a non-callable callback is set | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setIgnoredAttributes(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. #### Parameters | | | | | --- | --- | --- | | array | $ignoredAttributes | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### protected bool isCircularReference(object $object, array $context) Detects if the configured circular reference limit is reached. #### Parameters | | | | | --- | --- | --- | | object | $object | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected mixed handleCircularReference(object $object) Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown. #### Parameters | | | | | --- | --- | --- | | object | $object | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. #### Parameters | | | | | --- | --- | --- | | string|object | $classOrObject | | | array | $context | | | bool | $attributesAsString | If false, return an array of {@link AttributeMetadataInterface} | #### Return Value | | | | --- | --- | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | if the 'allow\_extra\_attributes' context variable is false and no class metadata factory is provided | ### protected bool isAllowedAttribute(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? #### Parameters | | | | | --- | --- | --- | | object|string | $classOrObject | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### protected array prepareForDenormalization(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. #### Parameters | | | | | --- | --- | --- | | object|array | $data | | #### Return Value | | | | --- | --- | | array | | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|null getConstructor(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | | ### protected object instantiateObject(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if it is present in the context with the object\_to\_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | | string | $format | | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | | | [MissingConstructorArgumentsException](../exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | ### protected array createChildContext(array $parentContext, string $attribute) #### Parameters | | | | | --- | --- | --- | | array | $parentContext | | | string | $attribute | | #### Return Value | | | | --- | --- | | array | | symfony ContextAwareDenormalizerInterface ContextAwareDenormalizerInterface ================================== interface **ContextAwareDenormalizerInterface** implements [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") Adds the support of an extra $context parameter for the supportsDenormalization method. Methods ------- | | | | | --- | --- | --- | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | from [DenormalizerInterface](denormalizerinterface#method_denormalize "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null, array $context = array()) Checks whether the given class is supported for denormalization by this normalizer. | | Details ------- ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsDenormalization(mixed $data, string $type, string $format = null, array $context = array()) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | | array | $context | | #### Return Value | | | | --- | --- | | bool | | symfony NormalizerAwareTrait NormalizerAwareTrait ===================== trait **NormalizerAwareTrait** NormalizerAware trait. Properties ---------- | | | | | | --- | --- | --- | --- | | protected [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") | $normalizer | | | Methods ------- | | | | | --- | --- | --- | | | [setNormalizer](#method_setNormalizer)([NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") $normalizer) Sets the normalizer. | | Details ------- ### setNormalizer([NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") $normalizer) Sets the normalizer. #### Parameters | | | | | --- | --- | --- | | [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") | $normalizer | A NormalizerInterface instance | symfony DenormalizerAwareInterface DenormalizerAwareInterface =========================== interface **DenormalizerAwareInterface** Class accepting a denormalizer. Methods ------- | | | | | --- | --- | --- | | | [setDenormalizer](#method_setDenormalizer)([DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") $denormalizer) Sets the owning Denormalizer object. | | Details ------- ### setDenormalizer([DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") $denormalizer) Sets the owning Denormalizer object. #### Parameters | | | | | --- | --- | --- | | [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") | $denormalizer | | symfony DenormalizerInterface DenormalizerInterface ====================== interface **DenormalizerInterface** Defines the interface of denormalizers. Methods ------- | | | | | --- | --- | --- | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | Details ------- ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | |
programming_docs
symfony NormalizerAwareInterface NormalizerAwareInterface ========================= interface **NormalizerAwareInterface** Class accepting a normalizer. Methods ------- | | | | | --- | --- | --- | | | [setNormalizer](#method_setNormalizer)([NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") $normalizer) Sets the owning Normalizer object. | | Details ------- ### setNormalizer([NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") $normalizer) Sets the owning Normalizer object. #### Parameters | | | | | --- | --- | --- | | [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") | $normalizer | | symfony CacheableSupportsMethodInterface CacheableSupportsMethodInterface ================================= interface **CacheableSupportsMethodInterface** Marker interface for normalizers and denormalizers that use only the type and the format in their supports\*() methods. By implementing this interface, the return value of the supports\*() methods will be cached by type and format. Methods ------- | | | | | --- | --- | --- | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | Details ------- ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | symfony DateIntervalNormalizer DateIntervalNormalizer ======================= class **DateIntervalNormalizer** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface"), [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") Normalizes an instance of {see \DateInterval} to an interval string. Denormalizes an interval string to an instance of {see \DateInterval}. Constants --------- | | | | --- | --- | | FORMAT\_KEY | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $format = 'P%yY%mM%dDT%hH%iM%sS') | | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | Details ------- ### \_\_construct(string $format = 'P%yY%mM%dDT%hH%iM%sS') #### Parameters | | | | | --- | --- | --- | | string | $format | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | symfony DenormalizerAwareTrait DenormalizerAwareTrait ======================= trait **DenormalizerAwareTrait** DenormalizerAware trait. Properties ---------- | | | | | | --- | --- | --- | --- | | protected [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") | $denormalizer | | | Methods ------- | | | | | --- | --- | --- | | | [setDenormalizer](#method_setDenormalizer)([DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") $denormalizer) Sets the Denormalizer. | | Details ------- ### setDenormalizer([DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") $denormalizer) Sets the Denormalizer. #### Parameters | | | | | --- | --- | --- | | [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") | $denormalizer | A DenormalizerInterface instance | symfony DataUriNormalizer DataUriNormalizer ================== class **DataUriNormalizer** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface"), [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") Normalizes an {see \SplFileInfo} object to a data URI. Denormalizes a data URI to a {see \SplFileObject} object. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([MimeTypeGuesserInterface](../../httpfoundation/file/mimetype/mimetypeguesserinterface "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface") $mimeTypeGuesser = null) | | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | Details ------- ### \_\_construct([MimeTypeGuesserInterface](../../httpfoundation/file/mimetype/mimetypeguesserinterface "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface") $mimeTypeGuesser = null) #### Parameters | | | | | --- | --- | --- | | [MimeTypeGuesserInterface](../../httpfoundation/file/mimetype/mimetypeguesserinterface "Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface") | $mimeTypeGuesser | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | #### See also | | | | --- | --- | | <https://gist.github.com/bgrins/6194623> | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | symfony JsonSerializableNormalizer JsonSerializableNormalizer =========================== class **JsonSerializableNormalizer** extends [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") A normalizer that uses an objects own JsonSerializable implementation. Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | CIRCULAR\_REFERENCE\_LIMIT | | | OBJECT\_TO\_POPULATE | | | GROUPS | | | ATTRIBUTES | | | ALLOW\_EXTRA\_ATTRIBUTES | | | DEFAULT\_CONSTRUCTOR\_ARGUMENTS | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | | protected int | $circularReferenceLimit | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected callable | $circularReferenceHandler | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")|null | $classMetadataFactory | | from [AbstractNormalizer](abstractnormalizer#property_classMetadataFactory "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")|null | $nameConverter | | from [AbstractNormalizer](abstractnormalizer#property_nameConverter "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $callbacks | | from [AbstractNormalizer](abstractnormalizer#property_callbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $ignoredAttributes | | from [AbstractNormalizer](abstractnormalizer#property_ignoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $camelizedAttributes | | from [AbstractNormalizer](abstractnormalizer#property_camelizedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null) Sets the {@link ClassMetadataFactoryInterface} to use. | from [AbstractNormalizer](abstractnormalizer#method___construct "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceLimit](#method_setCircularReferenceLimit)(int $circularReferenceLimit) Set circular reference limit. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceHandler](#method_setCircularReferenceHandler)(callable $circularReferenceHandler) Set circular reference handler. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCallbacks](#method_setCallbacks)(array $callbacks) Set normalization callbacks. | from [AbstractNormalizer](abstractnormalizer#method_setCallbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setIgnoredAttributes](#method_setIgnoredAttributes)(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. | from [AbstractNormalizer](abstractnormalizer#method_setIgnoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | | bool | [isCircularReference](#method_isCircularReference)(object $object, array $context) Detects if the configured circular reference limit is reached. | from [AbstractNormalizer](abstractnormalizer#method_isCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | mixed | [handleCircularReference](#method_handleCircularReference)(object $object) Handles a circular reference. | from [AbstractNormalizer](abstractnormalizer#method_handleCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | [getAllowedAttributes](#method_getAllowedAttributes)(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. | from [AbstractNormalizer](abstractnormalizer#method_getAllowedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [isAllowedAttribute](#method_isAllowedAttribute)(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? | from [AbstractNormalizer](abstractnormalizer#method_isAllowedAttribute "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | array | [prepareForDenormalization](#method_prepareForDenormalization)(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. | from [AbstractNormalizer](abstractnormalizer#method_prepareForDenormalization "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | [getConstructor](#method_getConstructor)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. | from [AbstractNormalizer](abstractnormalizer#method_getConstructor "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | object | [instantiateObject](#method_instantiateObject)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. | from [AbstractNormalizer](abstractnormalizer#method_instantiateObject "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | array | [createChildContext](#method_createChildContext)(array $parentContext, string $attribute) | from [AbstractNormalizer](abstractnormalizer#method_createChildContext "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null) Sets the {@link ClassMetadataFactoryInterface} to use. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | | [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") | $nameConverter | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceLimit(int $circularReferenceLimit) Set circular reference limit. #### Parameters | | | | | --- | --- | --- | | int | $circularReferenceLimit | Limit of iterations for the same object | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceHandler(callable $circularReferenceHandler) Set circular reference handler. #### Parameters | | | | | --- | --- | --- | | callable | $circularReferenceHandler | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCallbacks(array $callbacks) Set normalization callbacks. #### Parameters | | | | | --- | --- | --- | | array | $callbacks | Help normalize the result | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | if a non-callable callback is set | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setIgnoredAttributes(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. #### Parameters | | | | | --- | --- | --- | | array | $ignoredAttributes | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### protected bool isCircularReference(object $object, array $context) Detects if the configured circular reference limit is reached. #### Parameters | | | | | --- | --- | --- | | object | $object | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected mixed handleCircularReference(object $object) Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown. #### Parameters | | | | | --- | --- | --- | | object | $object | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. #### Parameters | | | | | --- | --- | --- | | string|object | $classOrObject | | | array | $context | | | bool | $attributesAsString | If false, return an array of {@link AttributeMetadataInterface} | #### Return Value | | | | --- | --- | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | if the 'allow\_extra\_attributes' context variable is false and no class metadata factory is provided | ### protected bool isAllowedAttribute(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? #### Parameters | | | | | --- | --- | --- | | object|string | $classOrObject | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### protected array prepareForDenormalization(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. #### Parameters | | | | | --- | --- | --- | | object|array | $data | | #### Return Value | | | | --- | --- | | array | | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|null getConstructor(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | | ### protected object instantiateObject(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if it is present in the context with the object\_to\_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | | string | $format | | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | | | [MissingConstructorArgumentsException](../exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | ### protected array createChildContext(array $parentContext, string $attribute) #### Parameters | | | | | --- | --- | --- | | array | $parentContext | | | string | $attribute | | #### Return Value | | | | --- | --- | | array | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated |
programming_docs
symfony CustomNormalizer CustomNormalizer ================= class **CustomNormalizer** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface"), [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface"), [SerializerAwareInterface](../serializerawareinterface "Symfony\Component\Serializer\SerializerAwareInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks if the given class implements the NormalizableInterface. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks if the given class implements the DenormalizableInterface. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsNormalization(mixed $data, string $format = null) Checks if the given class implements the NormalizableInterface. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks if the given class implements the DenormalizableInterface. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | symfony ObjectToPopulateTrait ObjectToPopulateTrait ====================== trait **ObjectToPopulateTrait** Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | symfony ConstraintViolationListNormalizer ConstraintViolationListNormalizer ================================== class **ConstraintViolationListNormalizer** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") A normalizer that normalizes a ConstraintViolationListInterface instance. This Normalizer implements RFC7807 {@link https://tools.ietf.org/html/rfc7807}. Methods ------- | | | | | --- | --- | --- | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | Details ------- ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | symfony DenormalizableInterface DenormalizableInterface ======================== interface **DenormalizableInterface** Defines the most basic interface a class must implement to be denormalizable. If a denormalizer is registered for the class and it doesn't implement the Denormalizable interfaces, the normalizer will be used instead Methods ------- | | | | | --- | --- | --- | | object | [denormalize](#method_denormalize)([DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") $denormalizer, array|string|int|float|bool $data, string|null $format = null, array $context = array()) Denormalizes the object back from an array of scalars|arrays. | | Details ------- ### object denormalize([DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") $denormalizer, array|string|int|float|bool $data, string|null $format = null, array $context = array()) Denormalizes the object back from an array of scalars|arrays. It is important to understand that the denormalize() call should denormalize recursively all child objects of the implementor. #### Parameters | | | | | --- | --- | --- | | [DenormalizerInterface](denormalizerinterface "Symfony\Component\Serializer\Normalizer\DenormalizerInterface") | $denormalizer | The denormalizer is given so that you can use it to denormalize objects contained within this object | | array|string|int|float|bool | $data | The data from which to re-create the object | | string|null | $format | The format is optionally given to be able to denormalize differently based on different input formats | | array | $context | Options for denormalizing | #### Return Value | | | | --- | --- | | object | | symfony NormalizerInterface NormalizerInterface ==================== interface **NormalizerInterface** Defines the interface of normalizers. Methods ------- | | | | | --- | --- | --- | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | Details ------- ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | symfony AbstractObjectNormalizer AbstractObjectNormalizer ========================= abstract class **AbstractObjectNormalizer** extends [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") Base class for a normalizer dealing with objects. Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | CIRCULAR\_REFERENCE\_LIMIT | | | OBJECT\_TO\_POPULATE | | | GROUPS | | | ATTRIBUTES | | | ALLOW\_EXTRA\_ATTRIBUTES | | | DEFAULT\_CONSTRUCTOR\_ARGUMENTS | | | ENABLE\_MAX\_DEPTH | | | DEPTH\_KEY\_PATTERN | | | DISABLE\_TYPE\_ENFORCEMENT | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | | protected int | $circularReferenceLimit | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected callable | $circularReferenceHandler | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")|null | $classMetadataFactory | | from [AbstractNormalizer](abstractnormalizer#property_classMetadataFactory "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")|null | $nameConverter | | from [AbstractNormalizer](abstractnormalizer#property_nameConverter "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $callbacks | | from [AbstractNormalizer](abstractnormalizer#property_callbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $ignoredAttributes | | from [AbstractNormalizer](abstractnormalizer#property_ignoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $camelizedAttributes | | from [AbstractNormalizer](abstractnormalizer#property_camelizedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface")|null | $classDiscriminatorResolver | | | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. | | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceLimit](#method_setCircularReferenceLimit)(int $circularReferenceLimit) Set circular reference limit. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceHandler](#method_setCircularReferenceHandler)(callable $circularReferenceHandler) Set circular reference handler. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCallbacks](#method_setCallbacks)(array $callbacks) Set normalization callbacks. | from [AbstractNormalizer](abstractnormalizer#method_setCallbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setIgnoredAttributes](#method_setIgnoredAttributes)(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. | from [AbstractNormalizer](abstractnormalizer#method_setIgnoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | from [AbstractNormalizer](abstractnormalizer#method_hasCacheableSupportsMethod "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [isCircularReference](#method_isCircularReference)(object $object, array $context) Detects if the configured circular reference limit is reached. | from [AbstractNormalizer](abstractnormalizer#method_isCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | mixed | [handleCircularReference](#method_handleCircularReference)(object $object) Handles a circular reference. | from [AbstractNormalizer](abstractnormalizer#method_handleCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | [getAllowedAttributes](#method_getAllowedAttributes)(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. | from [AbstractNormalizer](abstractnormalizer#method_getAllowedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [isAllowedAttribute](#method_isAllowedAttribute)(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? | from [AbstractNormalizer](abstractnormalizer#method_isAllowedAttribute "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | array | [prepareForDenormalization](#method_prepareForDenormalization)(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. | from [AbstractNormalizer](abstractnormalizer#method_prepareForDenormalization "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | [getConstructor](#method_getConstructor)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. | from [AbstractNormalizer](abstractnormalizer#method_getConstructor "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | object | [instantiateObject](#method_instantiateObject)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. | | | array | [createChildContext](#method_createChildContext)(array $parentContext, string $attribute) | from [AbstractNormalizer](abstractnormalizer#method_createChildContext "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | | | string[] | [getAttributes](#method_getAttributes)(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. | | | string[] | [extractAttributes](#method_extractAttributes)(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. | | | mixed | [getAttributeValue](#method_getAttributeValue)(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. | | | void | [setMaxDepthHandler](#method_setMaxDepthHandler)(callable|null $handler) Sets a handler function that will be called when the max depth is reached. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | | [setAttributeValue](#method_setAttributeValue)(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | | [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") | $nameConverter | | | [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") | $propertyTypeExtractor | | | [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") | $classDiscriminatorResolver | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceLimit(int $circularReferenceLimit) Set circular reference limit. #### Parameters | | | | | --- | --- | --- | | int | $circularReferenceLimit | Limit of iterations for the same object | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceHandler(callable $circularReferenceHandler) Set circular reference handler. #### Parameters | | | | | --- | --- | --- | | callable | $circularReferenceHandler | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCallbacks(array $callbacks) Set normalization callbacks. #### Parameters | | | | | --- | --- | --- | | array | $callbacks | Help normalize the result | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | if a non-callable callback is set | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setIgnoredAttributes(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. #### Parameters | | | | | --- | --- | --- | | array | $ignoredAttributes | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### protected bool isCircularReference(object $object, array $context) Detects if the configured circular reference limit is reached. #### Parameters | | | | | --- | --- | --- | | object | $object | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected mixed handleCircularReference(object $object) Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown. #### Parameters | | | | | --- | --- | --- | | object | $object | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. #### Parameters | | | | | --- | --- | --- | | string|object | $classOrObject | | | array | $context | | | bool | $attributesAsString | If false, return an array of {@link AttributeMetadataInterface} | #### Return Value | | | | --- | --- | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | if the 'allow\_extra\_attributes' context variable is false and no class metadata factory is provided | ### protected bool isAllowedAttribute(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? #### Parameters | | | | | --- | --- | --- | | object|string | $classOrObject | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### protected array prepareForDenormalization(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. #### Parameters | | | | | --- | --- | --- | | object|array | $data | | #### Return Value | | | | --- | --- | | array | | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|null getConstructor(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | | ### protected object instantiateObject(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if it is present in the context with the object\_to\_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | | string | $format | | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | | | [MissingConstructorArgumentsException](../exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | ### protected array createChildContext(array $parentContext, string $attribute) #### Parameters | | | | | --- | --- | --- | | array | $parentContext | | | string | $attribute | | #### Return Value | | | | --- | --- | | array | | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### protected string[] getAttributes(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### abstract protected string[] extractAttributes(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### abstract protected mixed getAttributeValue(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | mixed | | ### void setMaxDepthHandler(callable|null $handler) Sets a handler function that will be called when the max depth is reached. #### Parameters | | | | | --- | --- | --- | | callable|null | $handler | | #### Return Value | | | | --- | --- | | void | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### abstract protected setAttributeValue(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | mixed | $value | | | string|null | $format | | | array | $context | |
programming_docs
symfony ObjectNormalizer ObjectNormalizer ================= class **ObjectNormalizer** extends [AbstractObjectNormalizer](abstractobjectnormalizer "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") Converts between objects and arrays using the PropertyAccess component. Traits ------ | | | | --- | --- | | [ObjectToPopulateTrait](objecttopopulatetrait "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [SerializerAwareTrait](../serializerawaretrait "Symfony\Component\Serializer\SerializerAwareTrait") | SerializerAware trait. | Constants --------- | | | | --- | --- | | CIRCULAR\_REFERENCE\_LIMIT | | | OBJECT\_TO\_POPULATE | | | GROUPS | | | ATTRIBUTES | | | ALLOW\_EXTRA\_ATTRIBUTES | | | DEFAULT\_CONSTRUCTOR\_ARGUMENTS | | | ENABLE\_MAX\_DEPTH | | | DEPTH\_KEY\_PATTERN | | | DISABLE\_TYPE\_ENFORCEMENT | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | from [SerializerAwareTrait](../serializerawaretrait#property_serializer "Symfony\Component\Serializer\SerializerAwareTrait") | | protected int | $circularReferenceLimit | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected callable | $circularReferenceHandler | | from [AbstractNormalizer](abstractnormalizer#property_circularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface")|null | $classMetadataFactory | | from [AbstractNormalizer](abstractnormalizer#property_classMetadataFactory "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface")|null | $nameConverter | | from [AbstractNormalizer](abstractnormalizer#property_nameConverter "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $callbacks | | from [AbstractNormalizer](abstractnormalizer#property_callbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $ignoredAttributes | | from [AbstractNormalizer](abstractnormalizer#property_ignoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected array | $camelizedAttributes | | from [AbstractNormalizer](abstractnormalizer#property_camelizedAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | protected [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface")|null | $classDiscriminatorResolver | | from [AbstractObjectNormalizer](abstractobjectnormalizer#property_classDiscriminatorResolver "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | protected | $propertyAccessor | | | Methods ------- | | | | | --- | --- | --- | | object|null | [extractObjectToPopulate](#method_extractObjectToPopulate)(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. | from [ObjectToPopulateTrait](objecttopopulatetrait#method_extractObjectToPopulate "Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait") | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. | from [SerializerAwareTrait](../serializerawaretrait#method_setSerializer "Symfony\Component\Serializer\SerializerAwareTrait") | | | [\_\_construct](#method___construct)([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyAccessorInterface](../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. | | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceLimit](#method_setCircularReferenceLimit)(int $circularReferenceLimit) Set circular reference limit. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceLimit "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCircularReferenceHandler](#method_setCircularReferenceHandler)(callable $circularReferenceHandler) Set circular reference handler. | from [AbstractNormalizer](abstractnormalizer#method_setCircularReferenceHandler "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setCallbacks](#method_setCallbacks)(array $callbacks) Set normalization callbacks. | from [AbstractNormalizer](abstractnormalizer#method_setCallbacks "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | [setIgnoredAttributes](#method_setIgnoredAttributes)(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. | from [AbstractNormalizer](abstractnormalizer#method_setIgnoredAttributes "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | | bool | [isCircularReference](#method_isCircularReference)(object $object, array $context) Detects if the configured circular reference limit is reached. | from [AbstractNormalizer](abstractnormalizer#method_isCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | mixed | [handleCircularReference](#method_handleCircularReference)(object $object) Handles a circular reference. | from [AbstractNormalizer](abstractnormalizer#method_handleCircularReference "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | [getAllowedAttributes](#method_getAllowedAttributes)(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. | | | bool | [isAllowedAttribute](#method_isAllowedAttribute)(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? | from [AbstractNormalizer](abstractnormalizer#method_isAllowedAttribute "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | array | [prepareForDenormalization](#method_prepareForDenormalization)(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. | from [AbstractNormalizer](abstractnormalizer#method_prepareForDenormalization "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | [getConstructor](#method_getConstructor)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. | from [AbstractNormalizer](abstractnormalizer#method_getConstructor "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | object | [instantiateObject](#method_instantiateObject)(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_instantiateObject "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | array | [createChildContext](#method_createChildContext)(array $parentContext, string $attribute) | from [AbstractNormalizer](abstractnormalizer#method_createChildContext "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_supportsNormalization "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_normalize "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | string[] | [getAttributes](#method_getAttributes)(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_getAttributes "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | string[] | [extractAttributes](#method_extractAttributes)(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. | | | mixed | [getAttributeValue](#method_getAttributeValue)(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. | | | void | [setMaxDepthHandler](#method_setMaxDepthHandler)(callable|null $handler) Sets a handler function that will be called when the max depth is reached. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_setMaxDepthHandler "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_supportsDenormalization "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | from [AbstractObjectNormalizer](abstractobjectnormalizer#method_denormalize "Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer") | | | [setAttributeValue](#method_setAttributeValue)(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. | | Details ------- ### protected object|null extractObjectToPopulate(string $class, array $context, string $key = null) Extract the `object_to_populate` field from the context if it exists and is an instance of the provided $class. #### Parameters | | | | | --- | --- | --- | | string | $class | The class the object should be | | array | $context | The denormalization context | | string | $key | They in which to look for the object to populate. Keeps backwards compatibility with `AbstractNormalizer`. | #### Return Value | | | | --- | --- | | object|null | an object if things check out, null otherwise | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the serializer. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | A SerializerInterface instance | ### \_\_construct([ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") $classMetadataFactory = null, [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") $nameConverter = null, [PropertyAccessorInterface](../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") $propertyAccessor = null, [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") $propertyTypeExtractor = null, [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") $classDiscriminatorResolver = null) Sets the {@link ClassMetadataFactoryInterface} to use. #### Parameters | | | | | --- | --- | --- | | [ClassMetadataFactoryInterface](../mapping/factory/classmetadatafactoryinterface "Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface") | $classMetadataFactory | | | [NameConverterInterface](../nameconverter/nameconverterinterface "Symfony\Component\Serializer\NameConverter\NameConverterInterface") | $nameConverter | | | [PropertyAccessorInterface](../../propertyaccess/propertyaccessorinterface "Symfony\Component\PropertyAccess\PropertyAccessorInterface") | $propertyAccessor | | | [PropertyTypeExtractorInterface](../../propertyinfo/propertytypeextractorinterface "Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface") | $propertyTypeExtractor | | | [ClassDiscriminatorResolverInterface](../mapping/classdiscriminatorresolverinterface "Symfony\Component\Serializer\Mapping\ClassDiscriminatorResolverInterface") | $classDiscriminatorResolver | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceLimit(int $circularReferenceLimit) Set circular reference limit. #### Parameters | | | | | --- | --- | --- | | int | $circularReferenceLimit | Limit of iterations for the same object | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCircularReferenceHandler(callable $circularReferenceHandler) Set circular reference handler. #### Parameters | | | | | --- | --- | --- | | callable | $circularReferenceHandler | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setCallbacks(array $callbacks) Set normalization callbacks. #### Parameters | | | | | --- | --- | --- | | array | $callbacks | Help normalize the result | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | if a non-callable callback is set | ### [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") setIgnoredAttributes(array $ignoredAttributes) Set ignored attributes for normalization and denormalization. #### Parameters | | | | | --- | --- | --- | | array | $ignoredAttributes | | #### Return Value | | | | --- | --- | | [AbstractNormalizer](abstractnormalizer "Symfony\Component\Serializer\Normalizer\AbstractNormalizer") | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | ### protected bool isCircularReference(object $object, array $context) Detects if the configured circular reference limit is reached. #### Parameters | | | | | --- | --- | --- | | object | $object | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected mixed handleCircularReference(object $object) Handles a circular reference. If a circular reference handler is set, it will be called. Otherwise, a {@class CircularReferenceException} will be thrown. #### Parameters | | | | | --- | --- | --- | | object | $object | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | | ### protected string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool getAllowedAttributes(string|object $classOrObject, array $context, bool $attributesAsString = false) Gets attributes to normalize using groups. #### Parameters | | | | | --- | --- | --- | | string|object | $classOrObject | | | array | $context | | | bool | $attributesAsString | If false, return an array of {@link AttributeMetadataInterface} | #### Return Value | | | | --- | --- | | string[]|[AttributeMetadataInterface](../mapping/attributemetadatainterface "Symfony\Component\Serializer\Mapping\AttributeMetadataInterface")[]|bool | | #### Exceptions | | | | --- | --- | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | if the 'allow\_extra\_attributes' context variable is false and no class metadata factory is provided | ### protected bool isAllowedAttribute(object|string $classOrObject, string $attribute, string|null $format = null, array $context = array()) Is this attribute allowed? #### Parameters | | | | | --- | --- | --- | | object|string | $classOrObject | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### protected array prepareForDenormalization(object|array $data) Normalizes the given data to an array. It's particularly useful during the denormalization process. #### Parameters | | | | | --- | --- | --- | | object|array | $data | | #### Return Value | | | | --- | --- | | array | | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|null getConstructor(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes) Returns the method to use to construct an object. This method must be either the object constructor or static. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|null | | ### protected object instantiateObject(array $data, string $class, array $context, [ReflectionClass](http://php.net/ReflectionClass) $reflectionClass, array|bool $allowedAttributes, string $format = null) Instantiates an object using constructor parameters when needed. This method also allows to denormalize data into an existing object if it is present in the context with the object\_to\_populate. This object is removed from the context before being returned to avoid side effects when recursively normalizing an object graph. #### Parameters | | | | | --- | --- | --- | | array | $data | | | string | $class | | | array | $context | | | [ReflectionClass](http://php.net/ReflectionClass) | $reflectionClass | | | array|bool | $allowedAttributes | | | string | $format | | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | | | [MissingConstructorArgumentsException](../exception/missingconstructorargumentsexception "Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException") | | ### protected array createChildContext(array $parentContext, string $attribute) #### Parameters | | | | | --- | --- | --- | | array | $parentContext | | | string | $attribute | | #### Return Value | | | | --- | --- | | array | | ### bool supportsNormalization(mixed $data, string $format = null) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | #### Return Value | | | | --- | --- | | bool | | ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### protected string[] getAttributes(object $object, string|null $format = null, array $context) Gets and caches attributes for the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### protected string[] extractAttributes(object $object, string|null $format = null, array $context = array()) Extracts attributes to normalize from the class of the given object, format and context. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | string[] | | ### protected mixed getAttributeValue(object $object, string $attribute, string|null $format = null, array $context = array()) Gets the attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | string|null | $format | | | array | $context | | #### Return Value | | | | --- | --- | | mixed | | ### void setMaxDepthHandler(callable|null $handler) Sets a handler function that will be called when the max depth is reached. #### Parameters | | | | | --- | --- | --- | | callable|null | $handler | | #### Return Value | | | | --- | --- | | void | | ### bool supportsDenormalization(mixed $data, string $type, string $format = null) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | #### Return Value | | | | --- | --- | | bool | | ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### protected setAttributeValue(object $object, string $attribute, mixed $value, string|null $format = null, array $context = array()) Sets attribute value. #### Parameters | | | | | --- | --- | --- | | object | $object | | | string | $attribute | | | mixed | $value | | | string|null | $format | | | array | $context | |
programming_docs
symfony ArrayDenormalizer ArrayDenormalizer ================== class **ArrayDenormalizer** implements [ContextAwareDenormalizerInterface](contextawaredenormalizerinterface "Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface"), [SerializerAwareInterface](../serializerawareinterface "Symfony\Component\Serializer\SerializerAwareInterface"), [CacheableSupportsMethodInterface](cacheablesupportsmethodinterface "Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface") Denormalizes arrays of objects. Methods ------- | | | | | --- | --- | --- | | object | [denormalize](#method_denormalize)(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. | | | bool | [supportsDenormalization](#method_supportsDenormalization)(mixed $data, string $type, string $format = null, array $context = array()) Checks whether the given class is supported for denormalization by this normalizer. | | | | [setSerializer](#method_setSerializer)([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the owning Serializer object. | | | bool | [hasCacheableSupportsMethod](#method_hasCacheableSupportsMethod)() | | Details ------- ### object denormalize(mixed $data, string $class, string $format = null, array $context = array()) Denormalizes data back into an object of the given class. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to restore | | string | $class | The expected class to instantiate | | string | $format | Format the given data was extracted from | | array | $context | Options available to the denormalizer | #### Return Value | | | | --- | --- | | object | | #### Exceptions | | | | --- | --- | | [BadMethodCallException](../exception/badmethodcallexception "Symfony\Component\Serializer\Exception\BadMethodCallException") | Occurs when the normalizer is not called in an expected context | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the arguments are not coherent or not supported | | [UnexpectedValueException](../exception/unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") | Occurs when the item cannot be hydrated with the given data | | [ExtraAttributesException](../exception/extraattributesexception "Symfony\Component\Serializer\Exception\ExtraAttributesException") | Occurs when the item doesn't have attribute to receive given data | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not supposed to denormalize | | [RuntimeException](../exception/runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") | Occurs if the class cannot be instantiated | ### bool supportsDenormalization(mixed $data, string $type, string $format = null, array $context = array()) Checks whether the given class is supported for denormalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to denormalize from | | string | $type | The class to which the data should be denormalized | | string | $format | The format being deserialized from | | array | $context | | #### Return Value | | | | --- | --- | | bool | | ### setSerializer([SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") $serializer) Sets the owning Serializer object. #### Parameters | | | | | --- | --- | --- | | [SerializerInterface](../serializerinterface "Symfony\Component\Serializer\SerializerInterface") | $serializer | | ### bool hasCacheableSupportsMethod() #### Return Value | | | | --- | --- | | bool | | symfony ContextAwareNormalizerInterface ContextAwareNormalizerInterface ================================ interface **ContextAwareNormalizerInterface** implements [NormalizerInterface](normalizerinterface "Symfony\Component\Serializer\Normalizer\NormalizerInterface") Adds the support of an extra $context parameter for the supportsNormalization method. Methods ------- | | | | | --- | --- | --- | | array|string|int|float|bool | [normalize](#method_normalize)(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. | from [NormalizerInterface](normalizerinterface#method_normalize "Symfony\Component\Serializer\Normalizer\NormalizerInterface") | | bool | [supportsNormalization](#method_supportsNormalization)(mixed $data, string $format = null, array $context = array()) Checks whether the given class is supported for normalization by this normalizer. | | Details ------- ### array|string|int|float|bool normalize(mixed $object, string $format = null, array $context = array()) Normalizes an object into a set of arrays/scalars. #### Parameters | | | | | --- | --- | --- | | mixed | $object | Object to normalize | | string | $format | Format the normalization result will be encoded as | | array | $context | Context options for the normalizer | #### Return Value | | | | --- | --- | | array|string|int|float|bool | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") | Occurs when the object given is not an attempted type for the normalizer | | [CircularReferenceException](../exception/circularreferenceexception "Symfony\Component\Serializer\Exception\CircularReferenceException") | Occurs when the normalizer detects a circular reference when no circular reference handler can fix it | | [LogicException](../exception/logicexception "Symfony\Component\Serializer\Exception\LogicException") | Occurs when the normalizer is not called in an expected context | ### bool supportsNormalization(mixed $data, string $format = null, array $context = array()) Checks whether the given class is supported for normalization by this normalizer. #### Parameters | | | | | --- | --- | --- | | mixed | $data | Data to normalize | | string | $format | The format being (de-)serialized from or into | | array | $context | | #### Return Value | | | | --- | --- | | bool | | symfony SerializerPass SerializerPass =============== class **SerializerPass** implements [CompilerPassInterface](../../dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface") Adds all services with the tags "serializer.encoder" and "serializer.normalizer" as encoders and normalizers to the "serializer" service. Traits ------ | | | | --- | --- | | [PriorityTaggedServiceTrait](../../dependencyinjection/compiler/prioritytaggedservicetrait "Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait") | Trait that allows a generic method to find and sort service by priority option in the tag. | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $serializerService = 'serializer', string $normalizerTag = 'serializer.normalizer', string $encoderTag = 'serializer.encoder') | | | | [process](#method_process)([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | | Details ------- ### \_\_construct(string $serializerService = 'serializer', string $normalizerTag = 'serializer.normalizer', string $encoderTag = 'serializer.encoder') #### Parameters | | | | | --- | --- | --- | | string | $serializerService | | | string | $normalizerTag | | | string | $encoderTag | | ### process([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. #### Parameters | | | | | --- | --- | --- | | [ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | | symfony NotNormalizableValueException NotNormalizableValueException ============================== class **NotNormalizableValueException** extends [UnexpectedValueException](unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") symfony UnexpectedValueException UnexpectedValueException ========================= class **UnexpectedValueException** extends [UnexpectedValueException](http://php.net/UnexpectedValueException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Serializer\Exception\ExceptionInterface") UnexpectedValueException. symfony InvalidArgumentException InvalidArgumentException ========================= class **InvalidArgumentException** extends [InvalidArgumentException](http://php.net/InvalidArgumentException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Serializer\Exception\ExceptionInterface") InvalidArgumentException. symfony ExceptionInterface ExceptionInterface =================== interface **ExceptionInterface** Base exception interface. symfony LogicException LogicException =============== class **LogicException** extends [LogicException](http://php.net/LogicException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Serializer\Exception\ExceptionInterface") LogicException. symfony UnsupportedException UnsupportedException ===================== class **UnsupportedException** extends [InvalidArgumentException](invalidargumentexception "Symfony\Component\Serializer\Exception\InvalidArgumentException") UnsupportedException. symfony RuntimeException RuntimeException ================= class **RuntimeException** extends [RuntimeException](http://php.net/RuntimeException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Serializer\Exception\ExceptionInterface") RuntimeException. symfony MappingException MappingException ================= class **MappingException** extends [RuntimeException](runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") MappingException. symfony BadMethodCallException BadMethodCallException ======================= class **BadMethodCallException** extends [BadMethodCallException](http://php.net/BadMethodCallException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Serializer\Exception\ExceptionInterface") symfony MissingConstructorArgumentsException MissingConstructorArgumentsException ===================================== class **MissingConstructorArgumentsException** extends [RuntimeException](runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") symfony CircularReferenceException CircularReferenceException =========================== class **CircularReferenceException** extends [RuntimeException](runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") CircularReferenceException. symfony NotEncodableValueException NotEncodableValueException =========================== class **NotEncodableValueException** extends [UnexpectedValueException](unexpectedvalueexception "Symfony\Component\Serializer\Exception\UnexpectedValueException") symfony ExtraAttributesException ExtraAttributesException ========================= class **ExtraAttributesException** extends [RuntimeException](runtimeexception "Symfony\Component\Serializer\Exception\RuntimeException") ExtraAttributesException. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $extraAttributes, [Exception](http://php.net/Exception) $previous = null) | | | array | [getExtraAttributes](#method_getExtraAttributes)() Get the extra attributes that are not allowed. | | Details ------- ### \_\_construct(array $extraAttributes, [Exception](http://php.net/Exception) $previous = null) #### Parameters | | | | | --- | --- | --- | | array | $extraAttributes | | | [Exception](http://php.net/Exception) | $previous | | ### array getExtraAttributes() Get the extra attributes that are not allowed. #### Return Value | | | | --- | --- | | array | | symfony Dotenv Dotenv ======= class **Dotenv** Manages .env files. Constants --------- | | | | --- | --- | | VARNAME\_REGEX | | | STATE\_VARNAME | | | STATE\_VALUE | | Methods ------- | | | | | --- | --- | --- | | void | [load](#method_load)(string $path, string ...$paths) Loads one or several .env files. | | | void | [populate](#method_populate)(array $values) Sets values as environment variables (via putenv, $\_ENV, and $\_SERVER). | | | array | [parse](#method_parse)(string $data, string $path = '.env') Parses the contents of an .env file. | | Details ------- ### void load(string $path, string ...$paths) Loads one or several .env files. #### Parameters | | | | | --- | --- | --- | | string | $path | A file to load | | string | ...$paths | A list of additional files to load | #### Return Value | | | | --- | --- | | void | | #### Exceptions | | | | --- | --- | | [FormatException](exception/formatexception "Symfony\Component\Dotenv\Exception\FormatException") | when a file has a syntax error | | [PathException](exception/pathexception "Symfony\Component\Dotenv\Exception\PathException") | when a file does not exist or is not readable | ### void populate(array $values) Sets values as environment variables (via putenv, $\_ENV, and $\_SERVER). Note that existing environment variables are not overridden. #### Parameters | | | | | --- | --- | --- | | array | $values | An array of env variables | #### Return Value | | | | --- | --- | | void | | ### array parse(string $data, string $path = '.env') Parses the contents of an .env file. #### Parameters | | | | | --- | --- | --- | | string | $data | The data to be parsed | | string | $path | The original file name where data where stored (used for more meaningful error messages) | #### Return Value | | | | --- | --- | | array | An array of env variables | #### Exceptions | | | | --- | --- | | [FormatException](exception/formatexception "Symfony\Component\Dotenv\Exception\FormatException") | when a file has a syntax error | symfony Symfony\Component\Dotenv\Exception Symfony\Component\Dotenv\Exception ================================== Classes ------- | | | | --- | --- | | [FormatException](exception/formatexception "Symfony\Component\Dotenv\Exception\FormatException") | Thrown when a file has a syntax error. | | [FormatExceptionContext](exception/formatexceptioncontext "Symfony\Component\Dotenv\Exception\FormatExceptionContext") | | | [PathException](exception/pathexception "Symfony\Component\Dotenv\Exception\PathException") | Thrown when a file does not exist or is not readable. | Interfaces ---------- | | | | --- | --- | | *[ExceptionInterface](exception/exceptioninterface "Symfony\Component\Dotenv\Exception\ExceptionInterface")* | Interface for exceptions. | symfony ExceptionInterface ExceptionInterface =================== interface **ExceptionInterface** Interface for exceptions. symfony PathException PathException ============== class **PathException** extends [RuntimeException](http://php.net/RuntimeException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Dotenv\Exception\ExceptionInterface") Thrown when a file does not exist or is not readable. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $path, int $code = 0, [Exception](http://php.net/Exception) $previous = null) | | Details ------- ### \_\_construct(string $path, int $code = 0, [Exception](http://php.net/Exception) $previous = null) #### Parameters | | | | | --- | --- | --- | | string | $path | | | int | $code | | | [Exception](http://php.net/Exception) | $previous | | symfony FormatException FormatException ================ class **FormatException** extends [LogicException](http://php.net/LogicException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Dotenv\Exception\ExceptionInterface") Thrown when a file has a syntax error. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $message, [FormatExceptionContext](formatexceptioncontext "Symfony\Component\Dotenv\Exception\FormatExceptionContext") $context, int $code = 0, [Exception](http://php.net/Exception) $previous = null) | | | | [getContext](#method_getContext)() | | Details ------- ### \_\_construct(string $message, [FormatExceptionContext](formatexceptioncontext "Symfony\Component\Dotenv\Exception\FormatExceptionContext") $context, int $code = 0, [Exception](http://php.net/Exception) $previous = null) #### Parameters | | | | | --- | --- | --- | | string | $message | | | [FormatExceptionContext](formatexceptioncontext "Symfony\Component\Dotenv\Exception\FormatExceptionContext") | $context | | | int | $code | | | [Exception](http://php.net/Exception) | $previous | | ### getContext() symfony FormatExceptionContext FormatExceptionContext ======================= class **FormatExceptionContext** Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $data, string $path, int $lineno, int $cursor) | | | | [getPath](#method_getPath)() | | | | [getLineno](#method_getLineno)() | | | | [getDetails](#method_getDetails)() | | Details ------- ### \_\_construct(string $data, string $path, int $lineno, int $cursor) #### Parameters | | | | | --- | --- | --- | | string | $data | | | string | $path | | | int | $lineno | | | int | $cursor | | ### getPath() ### getLineno() ### getDetails() symfony ValidatorBuilder ValidatorBuilder ================= class **ValidatorBuilder** implements [ValidatorBuilderInterface](validatorbuilderinterface "Symfony\Component\Validator\ValidatorBuilderInterface") The default implementation of {@link ValidatorBuilderInterface}. Methods ------- | | | | | --- | --- | --- | | $this | [addObjectInitializer](#method_addObjectInitializer)([ObjectInitializerInterface](objectinitializerinterface "Symfony\Component\Validator\ObjectInitializerInterface") $initializer) Adds an object initializer to the validator. | | | $this | [addObjectInitializers](#method_addObjectInitializers)(array $initializers) Adds a list of object initializers to the validator. | | | $this | [addXmlMapping](#method_addXmlMapping)(string $path) Adds an XML constraint mapping file to the validator. | | | $this | [addXmlMappings](#method_addXmlMappings)(array $paths) Adds a list of XML constraint mapping files to the validator. | | | $this | [addYamlMapping](#method_addYamlMapping)(string $path) Adds a YAML constraint mapping file to the validator. | | | $this | [addYamlMappings](#method_addYamlMappings)(array $paths) Adds a list of YAML constraint mappings file to the validator. | | | $this | [addMethodMapping](#method_addMethodMapping)(string $methodName) Enables constraint mapping using the given static method. | | | $this | [addMethodMappings](#method_addMethodMappings)(array $methodNames) Enables constraint mapping using the given static methods. | | | $this | [enableAnnotationMapping](#method_enableAnnotationMapping)(Reader $annotationReader = null) Enables annotation based constraint mapping. | | | $this | [disableAnnotationMapping](#method_disableAnnotationMapping)() Disables annotation based constraint mapping. | | | $this | [setMetadataFactory](#method_setMetadataFactory)([MetadataFactoryInterface](mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory) Sets the class metadata factory used by the validator. | | | $this | [setMetadataCache](#method_setMetadataCache)([CacheInterface](mapping/cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") $cache) Sets the cache for caching class metadata. | | | $this | [setConstraintValidatorFactory](#method_setConstraintValidatorFactory)([ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory) Sets the constraint validator factory used by the validator. | | | $this | [setTranslator](#method_setTranslator)([TranslatorInterface](../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator) Sets the translator used for translating violation messages. | | | $this | [setTranslationDomain](#method_setTranslationDomain)(string $translationDomain) Sets the default translation domain of violation messages. | | | [LoaderInterface](mapping/loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getLoaders](#method_getLoaders)() | | | [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | [getValidator](#method_getValidator)() Builds and returns a new validator object. | | Details ------- ### $this addObjectInitializer([ObjectInitializerInterface](objectinitializerinterface "Symfony\Component\Validator\ObjectInitializerInterface") $initializer) Adds an object initializer to the validator. #### Parameters | | | | | --- | --- | --- | | [ObjectInitializerInterface](objectinitializerinterface "Symfony\Component\Validator\ObjectInitializerInterface") | $initializer | | #### Return Value | | | | --- | --- | | $this | | ### $this addObjectInitializers(array $initializers) Adds a list of object initializers to the validator. #### Parameters | | | | | --- | --- | --- | | array | $initializers | | #### Return Value | | | | --- | --- | | $this | | ### $this addXmlMapping(string $path) Adds an XML constraint mapping file to the validator. #### Parameters | | | | | --- | --- | --- | | string | $path | The path to the mapping file | #### Return Value | | | | --- | --- | | $this | | ### $this addXmlMappings(array $paths) Adds a list of XML constraint mapping files to the validator. #### Parameters | | | | | --- | --- | --- | | array | $paths | The paths to the mapping files | #### Return Value | | | | --- | --- | | $this | | ### $this addYamlMapping(string $path) Adds a YAML constraint mapping file to the validator. #### Parameters | | | | | --- | --- | --- | | string | $path | The path to the mapping file | #### Return Value | | | | --- | --- | | $this | | ### $this addYamlMappings(array $paths) Adds a list of YAML constraint mappings file to the validator. #### Parameters | | | | | --- | --- | --- | | array | $paths | The paths to the mapping files | #### Return Value | | | | --- | --- | | $this | | ### $this addMethodMapping(string $methodName) Enables constraint mapping using the given static method. #### Parameters | | | | | --- | --- | --- | | string | $methodName | The name of the method | #### Return Value | | | | --- | --- | | $this | | ### $this addMethodMappings(array $methodNames) Enables constraint mapping using the given static methods. #### Parameters | | | | | --- | --- | --- | | array | $methodNames | The names of the methods | #### Return Value | | | | --- | --- | | $this | | ### $this enableAnnotationMapping(Reader $annotationReader = null) Enables annotation based constraint mapping. #### Parameters | | | | | --- | --- | --- | | Reader | $annotationReader | | #### Return Value | | | | --- | --- | | $this | | ### $this disableAnnotationMapping() Disables annotation based constraint mapping. #### Return Value | | | | --- | --- | | $this | | ### $this setMetadataFactory([MetadataFactoryInterface](mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory) Sets the class metadata factory used by the validator. #### Parameters | | | | | --- | --- | --- | | [MetadataFactoryInterface](mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | $metadataFactory | | #### Return Value | | | | --- | --- | | $this | | ### $this setMetadataCache([CacheInterface](mapping/cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") $cache) Sets the cache for caching class metadata. #### Parameters | | | | | --- | --- | --- | | [CacheInterface](mapping/cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") | $cache | | #### Return Value | | | | --- | --- | | $this | | ### $this setConstraintValidatorFactory([ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory) Sets the constraint validator factory used by the validator. #### Parameters | | | | | --- | --- | --- | | [ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") | $validatorFactory | | #### Return Value | | | | --- | --- | | $this | | ### $this setTranslator([TranslatorInterface](../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator) Sets the translator used for translating violation messages. #### Parameters | | | | | --- | --- | --- | | [TranslatorInterface](../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | | #### Return Value | | | | --- | --- | | $this | | ### $this setTranslationDomain(string $translationDomain) Sets the default translation domain of violation messages. The same message can have different translations in different domains. Pass the domain that is used for violation messages by default to this method. #### Parameters | | | | | --- | --- | --- | | string | $translationDomain | The translation domain of the violation messages | #### Return Value | | | | --- | --- | | $this | | ### [LoaderInterface](mapping/loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getLoaders() #### Return Value | | | | --- | --- | | [LoaderInterface](mapping/loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | | ### [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") getValidator() Builds and returns a new validator object. #### Return Value | | | | --- | --- | | [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | The built validator |
programming_docs
symfony ConstraintViolationInterface ConstraintViolationInterface ============================= interface **ConstraintViolationInterface** A violation of a constraint that happened during validation. For each constraint that fails during validation one or more violations are created. The violations store the violation message, the path to the failing element in the validation graph and the root element that was originally passed to the validator. For example, take the following graph: ``` (Person)---(firstName: string) \ (address: Address)---(street: string) ``` If the Person object is validated and validation fails for the "firstName" property, the generated violation has the Person instance as root and the property path "firstName". If validation fails for the "street" property of the related Address instance, the root element is still the person, but the property path is "address.street". Methods ------- | | | | | --- | --- | --- | | string | [getMessage](#method_getMessage)() Returns the violation message. | | | string | [getMessageTemplate](#method_getMessageTemplate)() Returns the raw violation message. | | | array | [getParameters](#method_getParameters)() Returns the parameters to be inserted into the raw violation message. | | | int|null | [getPlural](#method_getPlural)() Returns a number for pluralizing the violation message. | | | mixed | [getRoot](#method_getRoot)() Returns the root element of the validation. | | | string | [getPropertyPath](#method_getPropertyPath)() Returns the property path from the root element to the violation. | | | mixed | [getInvalidValue](#method_getInvalidValue)() Returns the value that caused the violation. | | | string|null | [getCode](#method_getCode)() Returns a machine-digestible error code for the violation. | | Details ------- ### string getMessage() Returns the violation message. #### Return Value | | | | --- | --- | | string | The violation message | ### string getMessageTemplate() Returns the raw violation message. The raw violation message contains placeholders for the parameters returned by {@link getParameters}. Typically you'll pass the message template and parameters to a translation engine. #### Return Value | | | | --- | --- | | string | The raw violation message | ### array getParameters() Returns the parameters to be inserted into the raw violation message. #### Return Value | | | | --- | --- | | array | a possibly empty list of parameters indexed by the names that appear in the message template | #### See also | | | | --- | --- | | getMessageTemplate() | | ### int|null getPlural() Returns a number for pluralizing the violation message. For example, the message template could have different translation based on a parameter "choices": * Please select exactly one entry. (choices=1) * Please select two entries. (choices=2) This method returns the value of the parameter for choosing the right pluralization form (in this case "choices"). #### Return Value | | | | --- | --- | | int|null | The number to use to pluralize of the message | ### mixed getRoot() Returns the root element of the validation. #### Return Value | | | | --- | --- | | mixed | The value that was passed originally to the validator when the validation was started. Because the validator traverses the object graph, the value at which the violation occurs is not necessarily the value that was originally validated. | ### string getPropertyPath() Returns the property path from the root element to the violation. #### Return Value | | | | --- | --- | | string | The property path indicates how the validator reached the invalid value from the root element. If the root element is a Person instance with a property "address" that contains an Address instance with an invalid property "street", the generated property path is "address.street". Property access is denoted by dots, while array access is denoted by square brackets, for example "addresses[1].street". | ### mixed getInvalidValue() Returns the value that caused the violation. #### Return Value | | | | --- | --- | | mixed | the invalid value that caused the validated constraint to fail | ### string|null getCode() Returns a machine-digestible error code for the violation. #### Return Value | | | | --- | --- | | string|null | The error code | symfony ConstraintValidatorFactoryInterface ConstraintValidatorFactoryInterface ==================================== interface **ConstraintValidatorFactoryInterface** Specifies an object able to return the correct ConstraintValidatorInterface instance given a Constraint object. Methods ------- | | | | | --- | --- | --- | | [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | [getInstance](#method_getInstance)([Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. | | Details ------- ### [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") getInstance([Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. #### Parameters | | | | | --- | --- | --- | | [Constraint](constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | | symfony Symfony\Component\Validator\Constraints Symfony\Component\Validator\Constraints ======================================= Classes ------- | | | | --- | --- | | [AbstractComparison](constraints/abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") | Used for the comparison of values. | | [AbstractComparisonValidator](constraints/abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | Provides a base class for the validation of property comparisons. | | [All](constraints/all "Symfony\Component\Validator\Constraints\All") | | | [AllValidator](constraints/allvalidator "Symfony\Component\Validator\Constraints\AllValidator") | | | [Bic](constraints/bic "Symfony\Component\Validator\Constraints\Bic") | | | [BicValidator](constraints/bicvalidator "Symfony\Component\Validator\Constraints\BicValidator") | | | [Blank](constraints/blank "Symfony\Component\Validator\Constraints\Blank") | | | [BlankValidator](constraints/blankvalidator "Symfony\Component\Validator\Constraints\BlankValidator") | | | [Callback](constraints/callback "Symfony\Component\Validator\Constraints\Callback") | | | [CallbackValidator](constraints/callbackvalidator "Symfony\Component\Validator\Constraints\CallbackValidator") | Validator for Callback constraint. | | [CardScheme](constraints/cardscheme "Symfony\Component\Validator\Constraints\CardScheme") | Metadata for the CardSchemeValidator. | | [CardSchemeValidator](constraints/cardschemevalidator "Symfony\Component\Validator\Constraints\CardSchemeValidator") | Validates that a card number belongs to a specified scheme. | | [Choice](constraints/choice "Symfony\Component\Validator\Constraints\Choice") | | | [ChoiceValidator](constraints/choicevalidator "Symfony\Component\Validator\Constraints\ChoiceValidator") | ChoiceValidator validates that the value is one of the expected values. | | [Collection](constraints/collection "Symfony\Component\Validator\Constraints\Collection") | | | [CollectionValidator](constraints/collectionvalidator "Symfony\Component\Validator\Constraints\CollectionValidator") | | | [Composite](constraints/composite "Symfony\Component\Validator\Constraints\Composite") | A constraint that is composed of other constraints. | | [Count](constraints/count "Symfony\Component\Validator\Constraints\Count") | | | [CountValidator](constraints/countvalidator "Symfony\Component\Validator\Constraints\CountValidator") | | | [Country](constraints/country "Symfony\Component\Validator\Constraints\Country") | | | [CountryValidator](constraints/countryvalidator "Symfony\Component\Validator\Constraints\CountryValidator") | Validates whether a value is a valid country code. | | [Currency](constraints/currency "Symfony\Component\Validator\Constraints\Currency") | | | [CurrencyValidator](constraints/currencyvalidator "Symfony\Component\Validator\Constraints\CurrencyValidator") | Validates whether a value is a valid currency. | | [Date](constraints/date "Symfony\Component\Validator\Constraints\Date") | | | [DateTime](constraints/datetime "Symfony\Component\Validator\Constraints\DateTime") | | | [DateTimeValidator](constraints/datetimevalidator "Symfony\Component\Validator\Constraints\DateTimeValidator") | | | [DateValidator](constraints/datevalidator "Symfony\Component\Validator\Constraints\DateValidator") | | | [Email](constraints/email "Symfony\Component\Validator\Constraints\Email") | | | [EmailValidator](constraints/emailvalidator "Symfony\Component\Validator\Constraints\EmailValidator") | | | [EqualTo](constraints/equalto "Symfony\Component\Validator\Constraints\EqualTo") | | | [EqualToValidator](constraints/equaltovalidator "Symfony\Component\Validator\Constraints\EqualToValidator") | Validates values are equal (==). | | [Existence](constraints/existence "Symfony\Component\Validator\Constraints\Existence") | | | [Expression](constraints/expression "Symfony\Component\Validator\Constraints\Expression") | | | [ExpressionValidator](constraints/expressionvalidator "Symfony\Component\Validator\Constraints\ExpressionValidator") | | | [File](constraints/file "Symfony\Component\Validator\Constraints\File") | | | [FileValidator](constraints/filevalidator "Symfony\Component\Validator\Constraints\FileValidator") | | | [GreaterThan](constraints/greaterthan "Symfony\Component\Validator\Constraints\GreaterThan") | | | [GreaterThanOrEqual](constraints/greaterthanorequal "Symfony\Component\Validator\Constraints\GreaterThanOrEqual") | | | [GreaterThanOrEqualValidator](constraints/greaterthanorequalvalidator "Symfony\Component\Validator\Constraints\GreaterThanOrEqualValidator") | Validates values are greater than or equal to the previous (>=). | | [GreaterThanValidator](constraints/greaterthanvalidator "Symfony\Component\Validator\Constraints\GreaterThanValidator") | Validates values are greater than the previous (>). | | [GroupSequence](constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | A sequence of validation groups. | | [GroupSequenceProvider](constraints/groupsequenceprovider "Symfony\Component\Validator\Constraints\GroupSequenceProvider") | Annotation to define a group sequence provider. | | [Iban](constraints/iban "Symfony\Component\Validator\Constraints\Iban") | | | [IbanValidator](constraints/ibanvalidator "Symfony\Component\Validator\Constraints\IbanValidator") | | | [IdenticalTo](constraints/identicalto "Symfony\Component\Validator\Constraints\IdenticalTo") | | | [IdenticalToValidator](constraints/identicaltovalidator "Symfony\Component\Validator\Constraints\IdenticalToValidator") | Validates values are identical (===). | | [Image](constraints/image "Symfony\Component\Validator\Constraints\Image") | | | [ImageValidator](constraints/imagevalidator "Symfony\Component\Validator\Constraints\ImageValidator") | Validates whether a value is a valid image file and is valid against minWidth, maxWidth, minHeight and maxHeight constraints. | | [Ip](constraints/ip "Symfony\Component\Validator\Constraints\Ip") | Validates that a value is a valid IP address. | | [IpValidator](constraints/ipvalidator "Symfony\Component\Validator\Constraints\IpValidator") | Validates whether a value is a valid IP address. | | [IsFalse](constraints/isfalse "Symfony\Component\Validator\Constraints\IsFalse") | | | [IsFalseValidator](constraints/isfalsevalidator "Symfony\Component\Validator\Constraints\IsFalseValidator") | | | [IsNull](constraints/isnull "Symfony\Component\Validator\Constraints\IsNull") | | | [IsNullValidator](constraints/isnullvalidator "Symfony\Component\Validator\Constraints\IsNullValidator") | | | [IsTrue](constraints/istrue "Symfony\Component\Validator\Constraints\IsTrue") | | | [IsTrueValidator](constraints/istruevalidator "Symfony\Component\Validator\Constraints\IsTrueValidator") | | | [Isbn](constraints/isbn "Symfony\Component\Validator\Constraints\Isbn") | | | [IsbnValidator](constraints/isbnvalidator "Symfony\Component\Validator\Constraints\IsbnValidator") | Validates whether the value is a valid ISBN-10 or ISBN-13. | | [Issn](constraints/issn "Symfony\Component\Validator\Constraints\Issn") | | | [IssnValidator](constraints/issnvalidator "Symfony\Component\Validator\Constraints\IssnValidator") | Validates whether the value is a valid ISSN. | | [Language](constraints/language "Symfony\Component\Validator\Constraints\Language") | | | [LanguageValidator](constraints/languagevalidator "Symfony\Component\Validator\Constraints\LanguageValidator") | Validates whether a value is a valid language code. | | [Length](constraints/length "Symfony\Component\Validator\Constraints\Length") | | | [LengthValidator](constraints/lengthvalidator "Symfony\Component\Validator\Constraints\LengthValidator") | | | [LessThan](constraints/lessthan "Symfony\Component\Validator\Constraints\LessThan") | | | [LessThanOrEqual](constraints/lessthanorequal "Symfony\Component\Validator\Constraints\LessThanOrEqual") | | | [LessThanOrEqualValidator](constraints/lessthanorequalvalidator "Symfony\Component\Validator\Constraints\LessThanOrEqualValidator") | Validates values are less than or equal to the previous (<=). | | [LessThanValidator](constraints/lessthanvalidator "Symfony\Component\Validator\Constraints\LessThanValidator") | Validates values are less than the previous (<). | | [Locale](constraints/locale "Symfony\Component\Validator\Constraints\Locale") | | | [LocaleValidator](constraints/localevalidator "Symfony\Component\Validator\Constraints\LocaleValidator") | Validates whether a value is a valid locale code. | | [Luhn](constraints/luhn "Symfony\Component\Validator\Constraints\Luhn") | Metadata for the LuhnValidator. | | [LuhnValidator](constraints/luhnvalidator "Symfony\Component\Validator\Constraints\LuhnValidator") | Validates a PAN using the LUHN Algorithm. | | [NotBlank](constraints/notblank "Symfony\Component\Validator\Constraints\NotBlank") | | | [NotBlankValidator](constraints/notblankvalidator "Symfony\Component\Validator\Constraints\NotBlankValidator") | | | [NotEqualTo](constraints/notequalto "Symfony\Component\Validator\Constraints\NotEqualTo") | | | [NotEqualToValidator](constraints/notequaltovalidator "Symfony\Component\Validator\Constraints\NotEqualToValidator") | Validates values are all unequal (!=). | | [NotIdenticalTo](constraints/notidenticalto "Symfony\Component\Validator\Constraints\NotIdenticalTo") | | | [NotIdenticalToValidator](constraints/notidenticaltovalidator "Symfony\Component\Validator\Constraints\NotIdenticalToValidator") | Validates values aren't identical (!==). | | [NotNull](constraints/notnull "Symfony\Component\Validator\Constraints\NotNull") | | | [NotNullValidator](constraints/notnullvalidator "Symfony\Component\Validator\Constraints\NotNullValidator") | | | [Optional](constraints/optional "Symfony\Component\Validator\Constraints\Optional") | | | [Range](constraints/range "Symfony\Component\Validator\Constraints\Range") | | | [RangeValidator](constraints/rangevalidator "Symfony\Component\Validator\Constraints\RangeValidator") | | | [Regex](constraints/regex "Symfony\Component\Validator\Constraints\Regex") | | | [RegexValidator](constraints/regexvalidator "Symfony\Component\Validator\Constraints\RegexValidator") | Validates whether a value match or not given regexp pattern. | | [Required](constraints/required "Symfony\Component\Validator\Constraints\Required") | | | [Time](constraints/time "Symfony\Component\Validator\Constraints\Time") | | | [TimeValidator](constraints/timevalidator "Symfony\Component\Validator\Constraints\TimeValidator") | | | [Traverse](constraints/traverse "Symfony\Component\Validator\Constraints\Traverse") | | | [Type](constraints/type "Symfony\Component\Validator\Constraints\Type") | | | [TypeValidator](constraints/typevalidator "Symfony\Component\Validator\Constraints\TypeValidator") | | | [Url](constraints/url "Symfony\Component\Validator\Constraints\Url") | | | [UrlValidator](constraints/urlvalidator "Symfony\Component\Validator\Constraints\UrlValidator") | | | [Uuid](constraints/uuid "Symfony\Component\Validator\Constraints\Uuid") | | | [UuidValidator](constraints/uuidvalidator "Symfony\Component\Validator\Constraints\UuidValidator") | Validates whether the value is a valid UUID (also known as GUID). | | [Valid](constraints/valid "Symfony\Component\Validator\Constraints\Valid") | | | [ValidValidator](constraints/validvalidator "Symfony\Component\Validator\Constraints\ValidValidator") | | symfony Symfony\Component\Validator\Util Symfony\Component\Validator\Util ================================ Classes ------- | | | | --- | --- | | [PropertyPath](util/propertypath "Symfony\Component\Validator\Util\PropertyPath") | Contains utility methods for dealing with property paths. | symfony ValidatorBuilderInterface ValidatorBuilderInterface ========================== interface **ValidatorBuilderInterface** A configurable builder for ValidatorInterface objects. Methods ------- | | | | | --- | --- | --- | | $this | [addObjectInitializer](#method_addObjectInitializer)([ObjectInitializerInterface](objectinitializerinterface "Symfony\Component\Validator\ObjectInitializerInterface") $initializer) Adds an object initializer to the validator. | | | $this | [addObjectInitializers](#method_addObjectInitializers)(array $initializers) Adds a list of object initializers to the validator. | | | $this | [addXmlMapping](#method_addXmlMapping)(string $path) Adds an XML constraint mapping file to the validator. | | | $this | [addXmlMappings](#method_addXmlMappings)(array $paths) Adds a list of XML constraint mapping files to the validator. | | | $this | [addYamlMapping](#method_addYamlMapping)(string $path) Adds a YAML constraint mapping file to the validator. | | | $this | [addYamlMappings](#method_addYamlMappings)(array $paths) Adds a list of YAML constraint mappings file to the validator. | | | $this | [addMethodMapping](#method_addMethodMapping)(string $methodName) Enables constraint mapping using the given static method. | | | $this | [addMethodMappings](#method_addMethodMappings)(array $methodNames) Enables constraint mapping using the given static methods. | | | $this | [enableAnnotationMapping](#method_enableAnnotationMapping)(Reader $annotationReader = null) Enables annotation based constraint mapping. | | | $this | [disableAnnotationMapping](#method_disableAnnotationMapping)() Disables annotation based constraint mapping. | | | $this | [setMetadataFactory](#method_setMetadataFactory)([MetadataFactoryInterface](mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory) Sets the class metadata factory used by the validator. | | | $this | [setMetadataCache](#method_setMetadataCache)([CacheInterface](mapping/cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") $cache) Sets the cache for caching class metadata. | | | $this | [setConstraintValidatorFactory](#method_setConstraintValidatorFactory)([ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory) Sets the constraint validator factory used by the validator. | | | $this | [setTranslator](#method_setTranslator)([TranslatorInterface](../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator) Sets the translator used for translating violation messages. | | | $this | [setTranslationDomain](#method_setTranslationDomain)(string $translationDomain) Sets the default translation domain of violation messages. | | | [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | [getValidator](#method_getValidator)() Builds and returns a new validator object. | | Details ------- ### $this addObjectInitializer([ObjectInitializerInterface](objectinitializerinterface "Symfony\Component\Validator\ObjectInitializerInterface") $initializer) Adds an object initializer to the validator. #### Parameters | | | | | --- | --- | --- | | [ObjectInitializerInterface](objectinitializerinterface "Symfony\Component\Validator\ObjectInitializerInterface") | $initializer | | #### Return Value | | | | --- | --- | | $this | | ### $this addObjectInitializers(array $initializers) Adds a list of object initializers to the validator. #### Parameters | | | | | --- | --- | --- | | array | $initializers | | #### Return Value | | | | --- | --- | | $this | | ### $this addXmlMapping(string $path) Adds an XML constraint mapping file to the validator. #### Parameters | | | | | --- | --- | --- | | string | $path | The path to the mapping file | #### Return Value | | | | --- | --- | | $this | | ### $this addXmlMappings(array $paths) Adds a list of XML constraint mapping files to the validator. #### Parameters | | | | | --- | --- | --- | | array | $paths | The paths to the mapping files | #### Return Value | | | | --- | --- | | $this | | ### $this addYamlMapping(string $path) Adds a YAML constraint mapping file to the validator. #### Parameters | | | | | --- | --- | --- | | string | $path | The path to the mapping file | #### Return Value | | | | --- | --- | | $this | | ### $this addYamlMappings(array $paths) Adds a list of YAML constraint mappings file to the validator. #### Parameters | | | | | --- | --- | --- | | array | $paths | The paths to the mapping files | #### Return Value | | | | --- | --- | | $this | | ### $this addMethodMapping(string $methodName) Enables constraint mapping using the given static method. #### Parameters | | | | | --- | --- | --- | | string | $methodName | The name of the method | #### Return Value | | | | --- | --- | | $this | | ### $this addMethodMappings(array $methodNames) Enables constraint mapping using the given static methods. #### Parameters | | | | | --- | --- | --- | | array | $methodNames | The names of the methods | #### Return Value | | | | --- | --- | | $this | | ### $this enableAnnotationMapping(Reader $annotationReader = null) Enables annotation based constraint mapping. #### Parameters | | | | | --- | --- | --- | | Reader | $annotationReader | | #### Return Value | | | | --- | --- | | $this | | ### $this disableAnnotationMapping() Disables annotation based constraint mapping. #### Return Value | | | | --- | --- | | $this | | ### $this setMetadataFactory([MetadataFactoryInterface](mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory) Sets the class metadata factory used by the validator. #### Parameters | | | | | --- | --- | --- | | [MetadataFactoryInterface](mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | $metadataFactory | | #### Return Value | | | | --- | --- | | $this | | ### $this setMetadataCache([CacheInterface](mapping/cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") $cache) Sets the cache for caching class metadata. #### Parameters | | | | | --- | --- | --- | | [CacheInterface](mapping/cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") | $cache | | #### Return Value | | | | --- | --- | | $this | | ### $this setConstraintValidatorFactory([ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory) Sets the constraint validator factory used by the validator. #### Parameters | | | | | --- | --- | --- | | [ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") | $validatorFactory | | #### Return Value | | | | --- | --- | | $this | | ### $this setTranslator([TranslatorInterface](../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator) Sets the translator used for translating violation messages. #### Parameters | | | | | --- | --- | --- | | [TranslatorInterface](../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | | #### Return Value | | | | --- | --- | | $this | | ### $this setTranslationDomain(string $translationDomain) Sets the default translation domain of violation messages. The same message can have different translations in different domains. Pass the domain that is used for violation messages by default to this method. #### Parameters | | | | | --- | --- | --- | | string | $translationDomain | The translation domain of the violation messages | #### Return Value | | | | --- | --- | | $this | | ### [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") getValidator() Builds and returns a new validator object. #### Return Value | | | | --- | --- | | [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | The built validator |
programming_docs
symfony ConstraintValidatorFactory ConstraintValidatorFactory =========================== class **ConstraintValidatorFactory** implements [ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") Default implementation of the ConstraintValidatorFactoryInterface. This enforces the convention that the validatedBy() method on any Constraint will return the class name of the ConstraintValidator that should validate the Constraint. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $validators | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)() | | | [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | [getInstance](#method_getInstance)([Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. | | Details ------- ### \_\_construct() ### [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") getInstance([Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. #### Parameters | | | | | --- | --- | --- | | [Constraint](constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | | symfony Symfony\Component\Validator\Exception Symfony\Component\Validator\Exception ===================================== Classes ------- | | | | --- | --- | | [BadMethodCallException](exception/badmethodcallexception "Symfony\Component\Validator\Exception\BadMethodCallException") | Base BadMethodCallException for the Validator component. | | [ConstraintDefinitionException](exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | | | [GroupDefinitionException](exception/groupdefinitionexception "Symfony\Component\Validator\Exception\GroupDefinitionException") | | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | Base InvalidArgumentException for the Validator component. | | [InvalidOptionsException](exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | | | [MappingException](exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | | | [MissingOptionsException](exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | | | [NoSuchMetadataException](exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | | | [OutOfBoundsException](exception/outofboundsexception "Symfony\Component\Validator\Exception\OutOfBoundsException") | Base OutOfBoundsException for the Validator component. | | [RuntimeException](exception/runtimeexception "Symfony\Component\Validator\Exception\RuntimeException") | Base RuntimeException for the Validator component. | | [UnexpectedTypeException](exception/unexpectedtypeexception "Symfony\Component\Validator\Exception\UnexpectedTypeException") | | | [UnsupportedMetadataException](exception/unsupportedmetadataexception "Symfony\Component\Validator\Exception\UnsupportedMetadataException") | | | [ValidatorException](exception/validatorexception "Symfony\Component\Validator\Exception\ValidatorException") | | Interfaces ---------- | | | | --- | --- | | *[ExceptionInterface](exception/exceptioninterface "Symfony\Component\Validator\Exception\ExceptionInterface")* | Base ExceptionInterface for the Validator component. | symfony GroupSequenceProviderInterface GroupSequenceProviderInterface =============================== interface **GroupSequenceProviderInterface** Defines the interface for a group sequence provider. Methods ------- | | | | | --- | --- | --- | | string[]|[GroupSequence](constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | [getGroupSequence](#method_getGroupSequence)() Returns which validation groups should be used for a certain state of the object. | | Details ------- ### string[]|[GroupSequence](constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") getGroupSequence() Returns which validation groups should be used for a certain state of the object. #### Return Value | | | | --- | --- | | string[]|[GroupSequence](constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | An array of validation groups | symfony ObjectInitializerInterface ObjectInitializerInterface =========================== interface **ObjectInitializerInterface** Prepares an object for validation. Concrete implementations of this interface are used by {@link Validator\ContextualValidatorInterface} to initialize objects just before validating them. Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)(object $object) Initializes an object just before validation. | | Details ------- ### initialize(object $object) Initializes an object just before validation. #### Parameters | | | | | --- | --- | --- | | object | $object | The object to validate | symfony Symfony\Component\Validator\DataCollector Symfony\Component\Validator\DataCollector ========================================= Classes ------- | | | | --- | --- | | [ValidatorDataCollector](datacollector/validatordatacollector "Symfony\Component\Validator\DataCollector\ValidatorDataCollector") | | symfony Symfony\Component\Validator\Context Symfony\Component\Validator\Context =================================== Classes ------- | | | | --- | --- | | [ExecutionContext](context/executioncontext "Symfony\Component\Validator\Context\ExecutionContext") | The context used and created by {@link ExecutionContextFactory}. | | [ExecutionContextFactory](context/executioncontextfactory "Symfony\Component\Validator\Context\ExecutionContextFactory") | Creates new {@link ExecutionContext} instances. | Interfaces ---------- | | | | --- | --- | | *[ExecutionContextFactoryInterface](context/executioncontextfactoryinterface "Symfony\Component\Validator\Context\ExecutionContextFactoryInterface")* | Creates instances of {@link ExecutionContextInterface}. | | *[ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface")* | The context of a validation run. | symfony Symfony\Component\Validator\Validator Symfony\Component\Validator\Validator ===================================== Classes ------- | | | | --- | --- | | [RecursiveContextualValidator](validator/recursivecontextualvalidator "Symfony\Component\Validator\Validator\RecursiveContextualValidator") | Recursive implementation of {@link ContextualValidatorInterface}. | | [RecursiveValidator](validator/recursivevalidator "Symfony\Component\Validator\Validator\RecursiveValidator") | Recursive implementation of {@link ValidatorInterface}. | | [TraceableValidator](validator/traceablevalidator "Symfony\Component\Validator\Validator\TraceableValidator") | Collects some data about validator calls. | Interfaces ---------- | | | | --- | --- | | *[ContextualValidatorInterface](validator/contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface")* | A validator in a specific execution context. | | *[ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface")* | Validates PHP values against constraints. | symfony Validation Validation =========== class **Validation** Entry point for the Validator component. Methods ------- | | | | | --- | --- | --- | | static [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | [createValidator](#method_createValidator)() Creates a new validator. | | | static [ValidatorBuilder](validatorbuilder "Symfony\Component\Validator\ValidatorBuilder") | [createValidatorBuilder](#method_createValidatorBuilder)() Creates a configurable builder for validator objects. | | Details ------- ### static [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") createValidator() Creates a new validator. If you want to configure the validator, use {@link createValidatorBuilder()} instead. #### Return Value | | | | --- | --- | | [ValidatorInterface](validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | The new validator | ### static [ValidatorBuilder](validatorbuilder "Symfony\Component\Validator\ValidatorBuilder") createValidatorBuilder() Creates a configurable builder for validator objects. #### Return Value | | | | --- | --- | | [ValidatorBuilder](validatorbuilder "Symfony\Component\Validator\ValidatorBuilder") | The new builder | symfony Symfony\Component\Validator\Violation Symfony\Component\Validator\Violation ===================================== Classes ------- | | | | --- | --- | | [ConstraintViolationBuilder](violation/constraintviolationbuilder "Symfony\Component\Validator\Violation\ConstraintViolationBuilder") | Default implementation of {@link ConstraintViolationBuilderInterface}. | Interfaces ---------- | | | | --- | --- | | *[ConstraintViolationBuilderInterface](violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface")* | Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} objects. | symfony Symfony\Component\Validator\Mapping Symfony\Component\Validator\Mapping =================================== Namespaces ---------- [Symfony\Component\Validator\Mapping\Cache](mapping/cache)[Symfony\Component\Validator\Mapping\Factory](mapping/factory)[Symfony\Component\Validator\Mapping\Loader](mapping/loader) Classes ------- | | | | --- | --- | | [CascadingStrategy](mapping/cascadingstrategy "Symfony\Component\Validator\Mapping\CascadingStrategy") | Specifies whether an object should be cascaded. | | [ClassMetadata](mapping/classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | Default implementation of {@link ClassMetadataInterface}. | | [GenericMetadata](mapping/genericmetadata "Symfony\Component\Validator\Mapping\GenericMetadata") | A generic container of {@link Constraint} objects. | | [GetterMetadata](mapping/gettermetadata "Symfony\Component\Validator\Mapping\GetterMetadata") | Stores all metadata needed for validating a class property via its getter method. | | [MemberMetadata](mapping/membermetadata "Symfony\Component\Validator\Mapping\MemberMetadata") | Stores all metadata needed for validating a class property. | | [PropertyMetadata](mapping/propertymetadata "Symfony\Component\Validator\Mapping\PropertyMetadata") | Stores all metadata needed for validating a class property. | | [TraversalStrategy](mapping/traversalstrategy "Symfony\Component\Validator\Mapping\TraversalStrategy") | Specifies whether and how a traversable object should be traversed. | Interfaces ---------- | | | | --- | --- | | *[ClassMetadataInterface](mapping/classmetadatainterface "Symfony\Component\Validator\Mapping\ClassMetadataInterface")* | Stores all metadata needed for validating objects of specific class. | | *[MetadataInterface](mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")* | A container for validation metadata. | | *[PropertyMetadataInterface](mapping/propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")* | Stores all metadata needed for validating the value of a class property. | symfony ConstraintValidator ConstraintValidator ==================== abstract class **ConstraintValidator** implements [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") Base class for constraint validators. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | | Details ------- ### initialize([ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | symfony Symfony\Component\Validator\Test Symfony\Component\Validator\Test ================================ Classes ------- | | | | --- | --- | | [ConstraintValidatorTestCase](test/constraintvalidatortestcase "Symfony\Component\Validator\Test\ConstraintValidatorTestCase") | A test case to ease testing Constraint Validators. | | [ConstraintViolationAssertion](test/constraintviolationassertion "Symfony\Component\Validator\Test\ConstraintViolationAssertion") | | symfony ConstraintViolationList ConstraintViolationList ======================== class **ConstraintViolationList** implements [IteratorAggregate](http://php.net/IteratorAggregate), [ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") Default implementation of {@ConstraintViolationListInterface}. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $violations = array()) Creates a new constraint violation list. | | | string | [\_\_toString](#method___toString)() Converts the violation into a string for debugging purposes. | | | | [add](#method_add)([ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Adds a constraint violation to this list. | | | | [addAll](#method_addAll)([ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") $otherList) Merges an existing violation list into this list. | | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | [get](#method_get)(int $offset) Returns the violation at a given offset. | | | bool | [has](#method_has)(int $offset) Returns whether the given offset exists. | | | | [set](#method_set)(int $offset, [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Sets a violation at a given offset. | | | | [remove](#method_remove)(int $offset) Removes a violation at a given offset. | | | [ArrayIterator](http://php.net/ArrayIterator)|[ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface")[] | [getIterator](#method_getIterator)() {@inheritdoc} | | | | [count](#method_count)() {@inheritdoc} | | | | [offsetExists](#method_offsetExists)($offset) {@inheritdoc} | | | | [offsetGet](#method_offsetGet)($offset) {@inheritdoc} | | | | [offsetSet](#method_offsetSet)($offset, $violation) {@inheritdoc} | | | | [offsetUnset](#method_offsetUnset)($offset) {@inheritdoc} | | | [ConstraintViolationList](constraintviolationlist "Symfony\Component\Validator\ConstraintViolationList") | [findByCodes](#method_findByCodes)(string|string[] $codes) Creates iterator for errors with specific codes. | | Details ------- ### \_\_construct(array $violations = array()) Creates a new constraint violation list. #### Parameters | | | | | --- | --- | --- | | array | $violations | The constraint violations to add to the list | ### string \_\_toString() Converts the violation into a string for debugging purposes. #### Return Value | | | | --- | --- | | string | The violation as string | ### add([ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Adds a constraint violation to this list. #### Parameters | | | | | --- | --- | --- | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | $violation | | ### addAll([ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") $otherList) Merges an existing violation list into this list. #### Parameters | | | | | --- | --- | --- | | [ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | $otherList | | ### [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") get(int $offset) Returns the violation at a given offset. #### Parameters | | | | | --- | --- | --- | | int | $offset | The offset of the violation | #### Return Value | | | | --- | --- | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | The violation | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](http://php.net/OutOfBoundsException) | if the offset does not exist | ### bool has(int $offset) Returns whether the given offset exists. #### Parameters | | | | | --- | --- | --- | | int | $offset | The violation offset | #### Return Value | | | | --- | --- | | bool | Whether the offset exists | ### set(int $offset, [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Sets a violation at a given offset. #### Parameters | | | | | --- | --- | --- | | int | $offset | The violation offset | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | $violation | The violation | ### remove(int $offset) Removes a violation at a given offset. #### Parameters | | | | | --- | --- | --- | | int | $offset | The offset to remove | ### [ArrayIterator](http://php.net/ArrayIterator)|[ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface")[] getIterator() {@inheritdoc} #### Return Value | | | | --- | --- | | [ArrayIterator](http://php.net/ArrayIterator)|[ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface")[] | | ### count() {@inheritdoc} ### offsetExists($offset) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $offset | | ### offsetGet($offset) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $offset | | ### offsetSet($offset, $violation) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $offset | | | | $violation | | ### offsetUnset($offset) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $offset | | ### [ConstraintViolationList](constraintviolationlist "Symfony\Component\Validator\ConstraintViolationList") findByCodes(string|string[] $codes) Creates iterator for errors with specific codes. #### Parameters | | | | | --- | --- | --- | | string|string[] | $codes | The codes to find | #### Return Value | | | | --- | --- | | [ConstraintViolationList](constraintviolationlist "Symfony\Component\Validator\ConstraintViolationList") | new instance which contains only specific errors |
programming_docs
symfony Symfony\Component\Validator\DependencyInjection Symfony\Component\Validator\DependencyInjection =============================================== Classes ------- | | | | --- | --- | | [AddConstraintValidatorsPass](dependencyinjection/addconstraintvalidatorspass "Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass") | | | [AddValidatorInitializersPass](dependencyinjection/addvalidatorinitializerspass "Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass") | | symfony ConstraintViolation ConstraintViolation ==================== class **ConstraintViolation** implements [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") Default implementation of {@ConstraintViolationInterface}. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string|null $message, string|null $messageTemplate, array $parameters, mixed $root, string|null $propertyPath, mixed $invalidValue, int $plural = null, mixed $code = null, [Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint = null, mixed $cause = null) Creates a new constraint violation. | | | string | [\_\_toString](#method___toString)() Converts the violation into a string for debugging purposes. | | | string | [getMessageTemplate](#method_getMessageTemplate)() Returns the raw violation message. | | | array | [getParameters](#method_getParameters)() Returns the parameters to be inserted into the raw violation message. | | | int|null | [getPlural](#method_getPlural)() Returns a number for pluralizing the violation message. | | | string | [getMessage](#method_getMessage)() Returns the violation message. | | | mixed | [getRoot](#method_getRoot)() Returns the root element of the validation. | | | string | [getPropertyPath](#method_getPropertyPath)() Returns the property path from the root element to the violation. | | | mixed | [getInvalidValue](#method_getInvalidValue)() Returns the value that caused the violation. | | | [Constraint](constraint "Symfony\Component\Validator\Constraint")|null | [getConstraint](#method_getConstraint)() Returns the constraint whose validation caused the violation. | | | mixed | [getCause](#method_getCause)() Returns the cause of the violation. | | | string|null | [getCode](#method_getCode)() Returns a machine-digestible error code for the violation. | | Details ------- ### \_\_construct(string|null $message, string|null $messageTemplate, array $parameters, mixed $root, string|null $propertyPath, mixed $invalidValue, int $plural = null, mixed $code = null, [Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint = null, mixed $cause = null) Creates a new constraint violation. #### Parameters | | | | | --- | --- | --- | | string|null | $message | The violation message | | string|null | $messageTemplate | The raw violation message | | array | $parameters | The parameters to substitute in the raw violation message | | mixed | $root | The value originally passed to the validator | | string|null | $propertyPath | The property path from the root value to the invalid value | | mixed | $invalidValue | The invalid value that caused this violation | | int | $plural | The number for determining the plural form when translating the message | | mixed | $code | The error code of the violation | | [Constraint](constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint whose validation caused the violation | | mixed | $cause | The cause of the violation | ### string \_\_toString() Converts the violation into a string for debugging purposes. #### Return Value | | | | --- | --- | | string | The violation as string | ### string getMessageTemplate() Returns the raw violation message. The raw violation message contains placeholders for the parameters returned by {@link getParameters}. Typically you'll pass the message template and parameters to a translation engine. #### Return Value | | | | --- | --- | | string | The raw violation message | ### array getParameters() Returns the parameters to be inserted into the raw violation message. #### Return Value | | | | --- | --- | | array | a possibly empty list of parameters indexed by the names that appear in the message template | ### int|null getPlural() Returns a number for pluralizing the violation message. For example, the message template could have different translation based on a parameter "choices": * Please select exactly one entry. (choices=1) * Please select two entries. (choices=2) This method returns the value of the parameter for choosing the right pluralization form (in this case "choices"). #### Return Value | | | | --- | --- | | int|null | The number to use to pluralize of the message | ### string getMessage() Returns the violation message. #### Return Value | | | | --- | --- | | string | The violation message | ### mixed getRoot() Returns the root element of the validation. #### Return Value | | | | --- | --- | | mixed | The value that was passed originally to the validator when the validation was started. Because the validator traverses the object graph, the value at which the violation occurs is not necessarily the value that was originally validated. | ### string getPropertyPath() Returns the property path from the root element to the violation. #### Return Value | | | | --- | --- | | string | The property path indicates how the validator reached the invalid value from the root element. If the root element is a Person instance with a property "address" that contains an Address instance with an invalid property "street", the generated property path is "address.street". Property access is denoted by dots, while array access is denoted by square brackets, for example "addresses[1].street". | ### mixed getInvalidValue() Returns the value that caused the violation. #### Return Value | | | | --- | --- | | mixed | the invalid value that caused the validated constraint to fail | ### [Constraint](constraint "Symfony\Component\Validator\Constraint")|null getConstraint() Returns the constraint whose validation caused the violation. #### Return Value | | | | --- | --- | | [Constraint](constraint "Symfony\Component\Validator\Constraint")|null | The constraint or null if it is not known | ### mixed getCause() Returns the cause of the violation. #### Return Value | | | | --- | --- | | mixed | | ### string|null getCode() Returns a machine-digestible error code for the violation. #### Return Value | | | | --- | --- | | string|null | The error code | symfony Constraint Constraint =========== abstract class **Constraint** Contains the properties of a constraint definition. A constraint can be defined on a class, a property or a getter method. The Constraint class encapsulates all the configuration required for validating this class, property or getter result successfully. Constraint instances are immutable and serializable. Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | | | mixed | $payload | Domain-specific data attached to a constraint. | | | array | $groups | The groups that the constraint belongs to | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | | | bool | [\_\_isset](#method___isset)(string $option) | | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony ConstraintValidatorInterface ConstraintValidatorInterface ============================= interface **ConstraintValidatorInterface** Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | | | | [validate](#method_validate)(mixed $value, [Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### validate(mixed $value, [Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony ContainerConstraintValidatorFactory ContainerConstraintValidatorFactory ==================================== class **ContainerConstraintValidatorFactory** implements [ConstraintValidatorFactoryInterface](constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") Uses a service container to create constraint validators. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(ContainerInterface $container) | | | [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | [getInstance](#method_getInstance)([Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. | | Details ------- ### \_\_construct(ContainerInterface $container) #### Parameters | | | | | --- | --- | --- | | ContainerInterface | $container | | ### [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") getInstance([Constraint](constraint "Symfony\Component\Validator\Constraint") $constraint) Given a Constraint, this returns the ConstraintValidatorInterface object that should be used to verify its validity. #### Parameters | | | | | --- | --- | --- | | [Constraint](constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | [ConstraintValidatorInterface](constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | | symfony ConstraintViolationListInterface ConstraintViolationListInterface ================================= interface **ConstraintViolationListInterface** implements [Traversable](http://php.net/Traversable), [Countable](http://php.net/Countable), [ArrayAccess](http://php.net/ArrayAccess) A list of constraint violations. Methods ------- | | | | | --- | --- | --- | | | [add](#method_add)([ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Adds a constraint violation to this list. | | | | [addAll](#method_addAll)([ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") $otherList) Merges an existing violation list into this list. | | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | [get](#method_get)(int $offset) Returns the violation at a given offset. | | | bool | [has](#method_has)(int $offset) Returns whether the given offset exists. | | | | [set](#method_set)(int $offset, [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Sets a violation at a given offset. | | | | [remove](#method_remove)(int $offset) Removes a violation at a given offset. | | Details ------- ### add([ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Adds a constraint violation to this list. #### Parameters | | | | | --- | --- | --- | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | $violation | | ### addAll([ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") $otherList) Merges an existing violation list into this list. #### Parameters | | | | | --- | --- | --- | | [ConstraintViolationListInterface](constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | $otherList | | ### [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") get(int $offset) Returns the violation at a given offset. #### Parameters | | | | | --- | --- | --- | | int | $offset | The offset of the violation | #### Return Value | | | | --- | --- | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | The violation | #### Exceptions | | | | --- | --- | | [OutOfBoundsException](http://php.net/OutOfBoundsException) | if the offset does not exist | ### bool has(int $offset) Returns whether the given offset exists. #### Parameters | | | | | --- | --- | --- | | int | $offset | The violation offset | #### Return Value | | | | --- | --- | | bool | Whether the offset exists | ### set(int $offset, [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") $violation) Sets a violation at a given offset. #### Parameters | | | | | --- | --- | --- | | int | $offset | The violation offset | | [ConstraintViolationInterface](constraintviolationinterface "Symfony\Component\Validator\ConstraintViolationInterface") | $violation | The violation | ### remove(int $offset) Removes a violation at a given offset. #### Parameters | | | | | --- | --- | --- | | int | $offset | The offset to remove |
programming_docs
symfony ValidatorDataCollector ValidatorDataCollector ======================= class **ValidatorDataCollector** extends [DataCollector](../../httpkernel/datacollector/datacollector "Symfony\Component\HttpKernel\DataCollector\DataCollector") implements [LateDataCollectorInterface](../../httpkernel/datacollector/latedatacollectorinterface "Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface") Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $data | | from [DataCollector](../../httpkernel/datacollector/datacollector#property_data "Symfony\Component\HttpKernel\DataCollector\DataCollector") | Methods ------- | | | | | --- | --- | --- | | | [serialize](#method_serialize)() | from [DataCollector](../../httpkernel/datacollector/datacollector#method_serialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | | [unserialize](#method_unserialize)($data) | from [DataCollector](../../httpkernel/datacollector/datacollector#method_unserialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | [cloneVar](#method_cloneVar)(mixed $var) Converts the variable into a serializable Data instance. | from [DataCollector](../../httpkernel/datacollector/datacollector#method_cloneVar "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | callable[] | [getCasters](#method_getCasters)() | | | | [\_\_construct](#method___construct)([TraceableValidator](../validator/traceablevalidator "Symfony\Component\Validator\Validator\TraceableValidator") $validator) | | | | [collect](#method_collect)([Request](../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. | | | | [reset](#method_reset)() Resets this data collector to its initial state. | | | | [lateCollect](#method_lateCollect)() Collects data as late as possible. | | | [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | [getCalls](#method_getCalls)() | | | int | [getViolationsCount](#method_getViolationsCount)() | | | string | [getName](#method_getName)() Returns the name of the collector. | | Details ------- ### serialize() ### unserialize($data) #### Parameters | | | | | --- | --- | --- | | | $data | | ### protected [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") cloneVar(mixed $var) Converts the variable into a serializable Data instance. This array can be displayed in the template using the VarDumper component. #### Parameters | | | | | --- | --- | --- | | mixed | $var | | #### Return Value | | | | --- | --- | | [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | | ### protected callable[] getCasters() #### Return Value | | | | --- | --- | | callable[] | The casters to add to the cloner | ### \_\_construct([TraceableValidator](../validator/traceablevalidator "Symfony\Component\Validator\Validator\TraceableValidator") $validator) #### Parameters | | | | | --- | --- | --- | | [TraceableValidator](../validator/traceablevalidator "Symfony\Component\Validator\Validator\TraceableValidator") | $validator | | ### collect([Request](../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. #### Parameters | | | | | --- | --- | --- | | [Request](../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | | | [Response](../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | | | [Exception](http://php.net/Exception) | $exception | | ### reset() Resets this data collector to its initial state. ### lateCollect() Collects data as late as possible. ### [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") getCalls() #### Return Value | | | | --- | --- | | [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | | ### int getViolationsCount() #### Return Value | | | | --- | --- | | int | | ### string getName() Returns the name of the collector. #### Return Value | | | | --- | --- | | string | The collector name | symfony GenericMetadata GenericMetadata ================ class **GenericMetadata** implements [MetadataInterface](metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") A generic container of {@link Constraint} objects. This class supports serialization and cloning. Properties ---------- | | | | | | --- | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | | | | array | $constraintsByGroup | | | | int | $cascadingStrategy | The strategy for cascading objects. | | | int | $traversalStrategy | The strategy for traversing traversable objects. | | Methods ------- | | | | | --- | --- | --- | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | | | | [\_\_clone](#method___clone)() Clones this object. | | | $this | [addConstraint](#method_addConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. | | | $this | [addConstraints](#method_addConstraints)(array $constraints) Adds an list of constraints. | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | | | bool | [hasConstraints](#method_hasConstraints)() Returns whether this element has any constraints. | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | | Details ------- ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | ### \_\_clone() Clones this object. ### $this addConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following: * {@link TraversalStrategy::IMPLICIT} if $traverse is enabled * {@link TraversalStrategy::NONE} if $traverse is disabled #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When trying to add the {@link Traverse} constraint | ### $this addConstraints(array $constraints) Adds an list of constraints. #### Parameters | | | | | --- | --- | --- | | array | $constraints | The constraints to add | #### Return Value | | | | --- | --- | | $this | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### bool hasConstraints() Returns whether this element has any constraints. #### Return Value | | | | --- | --- | | bool | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | symfony MemberMetadata MemberMetadata =============== abstract class **MemberMetadata** extends [GenericMetadata](genericmetadata "Symfony\Component\Validator\Mapping\GenericMetadata") implements [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface") Stores all metadata needed for validating a class property. The method of accessing the property's value must be specified by subclasses by implementing the {@link newReflectionMember()} method. This class supports serialization and cloning. Properties ---------- | | | | | | --- | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | | from [GenericMetadata](genericmetadata#property_constraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | array | $constraintsByGroup | | from [GenericMetadata](genericmetadata#property_constraintsByGroup "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $cascadingStrategy | The strategy for cascading objects. | from [GenericMetadata](genericmetadata#property_cascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $traversalStrategy | The strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#property_traversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | $class | | | | | $name | | | | | $property | | | Methods ------- | | | | | --- | --- | --- | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | | | | [\_\_clone](#method___clone)() Clones this object. | from [GenericMetadata](genericmetadata#method___clone "Symfony\Component\Validator\Mapping\GenericMetadata") | | $this | [addConstraint](#method_addConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. | | | $this | [addConstraints](#method_addConstraints)(array $constraints) Adds an list of constraints. | from [GenericMetadata](genericmetadata#method_addConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | from [GenericMetadata](genericmetadata#method_getConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | bool | [hasConstraints](#method_hasConstraints)() Returns whether this element has any constraints. | from [GenericMetadata](genericmetadata#method_hasConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | from [GenericMetadata](genericmetadata#method_findConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | from [GenericMetadata](genericmetadata#method_getCascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#method_getTraversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | [\_\_construct](#method___construct)(string $class, string $name, string $property) | | | string | [getName](#method_getName)() Returns the name of the member. | | | | [getClassName](#method_getClassName)() {@inheritdoc} | | | string | [getPropertyName](#method_getPropertyName)() Returns the name of the property. | | | bool | [isPublic](#method_isPublic)(object|string $objectOrClassName) Returns whether this member is public. | | | bool | [isProtected](#method_isProtected)(object|string $objectOrClassName) Returns whether this member is protected. | | | bool | [isPrivate](#method_isPrivate)(object|string $objectOrClassName) Returns whether this member is private. | | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | [getReflectionMember](#method_getReflectionMember)(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. | | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | [newReflectionMember](#method_newReflectionMember)(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. | | Details ------- ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | ### \_\_clone() Clones this object. ### $this addConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following: * {@link TraversalStrategy::IMPLICIT} if $traverse is enabled * {@link TraversalStrategy::NONE} if $traverse is disabled #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When trying to add the {@link Traverse} constraint | ### $this addConstraints(array $constraints) Adds an list of constraints. #### Parameters | | | | | --- | --- | --- | | array | $constraints | The constraints to add | #### Return Value | | | | --- | --- | | $this | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### bool hasConstraints() Returns whether this element has any constraints. #### Return Value | | | | --- | --- | | bool | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | ### \_\_construct(string $class, string $name, string $property) #### Parameters | | | | | --- | --- | --- | | string | $class | The name of the class this member is defined on | | string | $name | The name of the member | | string | $property | The property the member belongs to | ### string getName() Returns the name of the member. #### Return Value | | | | --- | --- | | string | | ### getClassName() {@inheritdoc} ### string getPropertyName() Returns the name of the property. #### Return Value | | | | --- | --- | | string | The property name | ### bool isPublic(object|string $objectOrClassName) Returns whether this member is public. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### bool isProtected(object|string $objectOrClassName) Returns whether this member is protected. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### bool isPrivate(object|string $objectOrClassName) Returns whether this member is private. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) getReflectionMember(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | The reflection instance | ### abstract protected [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) newReflectionMember(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. Must be implemented by subclasses. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | The reflection instance | symfony Symfony\Component\Validator\Mapping\Loader Symfony\Component\Validator\Mapping\Loader ========================================== Classes ------- | | | | --- | --- | | [AbstractLoader](loader/abstractloader "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | Base loader for validation metadata. | | [AnnotationLoader](loader/annotationloader "Symfony\Component\Validator\Mapping\Loader\AnnotationLoader") | Loads validation metadata using a Doctrine annotation {@link Reader}. | | [FileLoader](loader/fileloader "Symfony\Component\Validator\Mapping\Loader\FileLoader") | Base loader for loading validation metadata from a file. | | [FilesLoader](loader/filesloader "Symfony\Component\Validator\Mapping\Loader\FilesLoader") | Base loader for loading validation metadata from a list of files. | | [LoaderChain](loader/loaderchain "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | Loads validation metadata from multiple {@link LoaderInterface} instances. | | [StaticMethodLoader](loader/staticmethodloader "Symfony\Component\Validator\Mapping\Loader\StaticMethodLoader") | Loads validation metadata by calling a static method on the loaded class. | | [XmlFileLoader](loader/xmlfileloader "Symfony\Component\Validator\Mapping\Loader\XmlFileLoader") | Loads validation metadata from an XML file. | | [XmlFilesLoader](loader/xmlfilesloader "Symfony\Component\Validator\Mapping\Loader\XmlFilesLoader") | Loads validation metadata from a list of XML files. | | [YamlFileLoader](loader/yamlfileloader "Symfony\Component\Validator\Mapping\Loader\YamlFileLoader") | Loads validation metadata from a YAML file. | | [YamlFilesLoader](loader/yamlfilesloader "Symfony\Component\Validator\Mapping\Loader\YamlFilesLoader") | Loads validation metadata from a list of YAML files. | Interfaces ---------- | | | | --- | --- | | *[LoaderInterface](loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")* | Loads validation metadata into {@link ClassMetadata} instances. |
programming_docs
symfony Symfony\Component\Validator\Mapping\Factory Symfony\Component\Validator\Mapping\Factory =========================================== Classes ------- | | | | --- | --- | | [BlackHoleMetadataFactory](factory/blackholemetadatafactory "Symfony\Component\Validator\Mapping\Factory\BlackHoleMetadataFactory") | Metadata factory that does not store metadata. | | [LazyLoadingMetadataFactory](factory/lazyloadingmetadatafactory "Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory") | Creates new {@link ClassMetadataInterface} instances. | Interfaces ---------- | | | | --- | --- | | *[MetadataFactoryInterface](factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface")* | Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. | symfony Symfony\Component\Validator\Mapping\Cache Symfony\Component\Validator\Mapping\Cache ========================================= Classes ------- | | | | --- | --- | | [DoctrineCache](cache/doctrinecache "Symfony\Component\Validator\Mapping\Cache\DoctrineCache") | Adapts a Doctrine cache to a CacheInterface. | | [Psr6Cache](cache/psr6cache "Symfony\Component\Validator\Mapping\Cache\Psr6Cache") | PSR-6 adapter. | Interfaces ---------- | | | | --- | --- | | *[CacheInterface](cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface")* | Persists ClassMetadata instances in a cache. | symfony TraversalStrategy TraversalStrategy ================== class **TraversalStrategy** Specifies whether and how a traversable object should be traversed. If the node traverser traverses a node whose value is an instance of {@link \Traversable}, and if that node is either a class node or if cascading is enabled, then the node's traversal strategy will be checked. Depending on the requested traversal strategy, the node traverser will iterate over the object and cascade each object or collection returned by the iterator. The traversal strategy is ignored for arrays. Arrays are always iterated. Constants --------- | | | | --- | --- | | IMPLICIT | *Specifies that a node's value should be iterated only if it is an instance of {@link \Traversable}.* | | NONE | *Specifies that a node's value should never be iterated.* | | TRAVERSE | *Specifies that a node's value should always be iterated. If the value is not an instance of {@link \Traversable}, an exception should be thrown.* | symfony MetadataInterface MetadataInterface ================== interface **MetadataInterface** A container for validation metadata. Most importantly, the metadata stores the constraints against which an object and its properties should be validated. Additionally, the metadata stores whether objects should be validated against their class' metadata and whether traversable objects should be traversed or not. Methods ------- | | | | | --- | --- | --- | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | | Details ------- ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | #### See also | | | | --- | --- | | [CascadingStrategy](cascadingstrategy "Symfony\Component\Validator\Mapping\CascadingStrategy") | | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | #### See also | | | | --- | --- | | [TraversalStrategy](traversalstrategy "Symfony\Component\Validator\Mapping\TraversalStrategy") | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | symfony PropertyMetadata PropertyMetadata ================= class **PropertyMetadata** extends [MemberMetadata](membermetadata "Symfony\Component\Validator\Mapping\MemberMetadata") Stores all metadata needed for validating a class property. The value of the property is obtained by directly accessing the property. The property will be accessed by reflection, so the access of private and protected properties is supported. This class supports serialization and cloning. Properties ---------- | | | | | | --- | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | | from [GenericMetadata](genericmetadata#property_constraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | array | $constraintsByGroup | | from [GenericMetadata](genericmetadata#property_constraintsByGroup "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $cascadingStrategy | The strategy for cascading objects. | from [GenericMetadata](genericmetadata#property_cascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $traversalStrategy | The strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#property_traversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | $class | | from [MemberMetadata](membermetadata#property_class "Symfony\Component\Validator\Mapping\MemberMetadata") | | | $name | | from [MemberMetadata](membermetadata#property_name "Symfony\Component\Validator\Mapping\MemberMetadata") | | | $property | | from [MemberMetadata](membermetadata#property_property "Symfony\Component\Validator\Mapping\MemberMetadata") | Methods ------- | | | | | --- | --- | --- | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | from [MemberMetadata](membermetadata#method___sleep "Symfony\Component\Validator\Mapping\MemberMetadata") | | | [\_\_clone](#method___clone)() Clones this object. | from [GenericMetadata](genericmetadata#method___clone "Symfony\Component\Validator\Mapping\GenericMetadata") | | $this | [addConstraint](#method_addConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. | from [MemberMetadata](membermetadata#method_addConstraint "Symfony\Component\Validator\Mapping\MemberMetadata") | | $this | [addConstraints](#method_addConstraints)(array $constraints) Adds an list of constraints. | from [GenericMetadata](genericmetadata#method_addConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | from [GenericMetadata](genericmetadata#method_getConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | bool | [hasConstraints](#method_hasConstraints)() Returns whether this element has any constraints. | from [GenericMetadata](genericmetadata#method_hasConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | from [GenericMetadata](genericmetadata#method_findConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | from [GenericMetadata](genericmetadata#method_getCascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#method_getTraversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | [\_\_construct](#method___construct)(string $class, string $name) | | | string | [getName](#method_getName)() Returns the name of the member. | from [MemberMetadata](membermetadata#method_getName "Symfony\Component\Validator\Mapping\MemberMetadata") | | | [getClassName](#method_getClassName)() {@inheritdoc} | from [MemberMetadata](membermetadata#method_getClassName "Symfony\Component\Validator\Mapping\MemberMetadata") | | string | [getPropertyName](#method_getPropertyName)() Returns the name of the property. | from [MemberMetadata](membermetadata#method_getPropertyName "Symfony\Component\Validator\Mapping\MemberMetadata") | | bool | [isPublic](#method_isPublic)(object|string $objectOrClassName) Returns whether this member is public. | from [MemberMetadata](membermetadata#method_isPublic "Symfony\Component\Validator\Mapping\MemberMetadata") | | bool | [isProtected](#method_isProtected)(object|string $objectOrClassName) Returns whether this member is protected. | from [MemberMetadata](membermetadata#method_isProtected "Symfony\Component\Validator\Mapping\MemberMetadata") | | bool | [isPrivate](#method_isPrivate)(object|string $objectOrClassName) Returns whether this member is private. | from [MemberMetadata](membermetadata#method_isPrivate "Symfony\Component\Validator\Mapping\MemberMetadata") | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | [getReflectionMember](#method_getReflectionMember)(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. | from [MemberMetadata](membermetadata#method_getReflectionMember "Symfony\Component\Validator\Mapping\MemberMetadata") | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | [newReflectionMember](#method_newReflectionMember)(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. | | | mixed | [getPropertyValue](#method_getPropertyValue)($object) Extracts the value of the property from the given container. | | Details ------- ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | ### \_\_clone() Clones this object. ### $this addConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following: * {@link TraversalStrategy::IMPLICIT} if $traverse is enabled * {@link TraversalStrategy::NONE} if $traverse is disabled #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When trying to add the {@link Traverse} constraint | ### $this addConstraints(array $constraints) Adds an list of constraints. #### Parameters | | | | | --- | --- | --- | | array | $constraints | The constraints to add | #### Return Value | | | | --- | --- | | $this | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### bool hasConstraints() Returns whether this element has any constraints. #### Return Value | | | | --- | --- | | bool | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | ### \_\_construct(string $class, string $name) #### Parameters | | | | | --- | --- | --- | | string | $class | The name of the class this member is defined on | | string | $name | The name of the member | #### Exceptions | | | | --- | --- | | [ValidatorException](../exception/validatorexception "Symfony\Component\Validator\Exception\ValidatorException") | | ### string getName() Returns the name of the member. #### Return Value | | | | --- | --- | | string | | ### getClassName() {@inheritdoc} ### string getPropertyName() Returns the name of the property. #### Return Value | | | | --- | --- | | string | The property name | ### bool isPublic(object|string $objectOrClassName) Returns whether this member is public. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### bool isProtected(object|string $objectOrClassName) Returns whether this member is protected. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### bool isPrivate(object|string $objectOrClassName) Returns whether this member is private. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) getReflectionMember(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | The reflection instance | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) newReflectionMember(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. Must be implemented by subclasses. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | The reflection instance | ### mixed getPropertyValue($object) Extracts the value of the property from the given container. #### Parameters | | | | | --- | --- | --- | | | $object | | #### Return Value | | | | --- | --- | | mixed | The value of the property | symfony PropertyMetadataInterface PropertyMetadataInterface ========================== interface **PropertyMetadataInterface** implements [MetadataInterface](metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") Stores all metadata needed for validating the value of a class property. Most importantly, the metadata stores the constraints against which the property's value should be validated. Additionally, the metadata stores whether objects stored in the property should be validated against their class' metadata and whether traversable objects should be traversed or not. Methods ------- | | | | | --- | --- | --- | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | from [MetadataInterface](metadatainterface#method_getCascadingStrategy "Symfony\Component\Validator\Mapping\MetadataInterface") | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | from [MetadataInterface](metadatainterface#method_getTraversalStrategy "Symfony\Component\Validator\Mapping\MetadataInterface") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | from [MetadataInterface](metadatainterface#method_getConstraints "Symfony\Component\Validator\Mapping\MetadataInterface") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | from [MetadataInterface](metadatainterface#method_findConstraints "Symfony\Component\Validator\Mapping\MetadataInterface") | | string | [getPropertyName](#method_getPropertyName)() Returns the name of the property. | | | mixed | [getPropertyValue](#method_getPropertyValue)(mixed $containingValue) Extracts the value of the property from the given container. | | Details ------- ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | #### See also | | | | --- | --- | | [CascadingStrategy](cascadingstrategy "Symfony\Component\Validator\Mapping\CascadingStrategy") | | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | #### See also | | | | --- | --- | | [TraversalStrategy](traversalstrategy "Symfony\Component\Validator\Mapping\TraversalStrategy") | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### string getPropertyName() Returns the name of the property. #### Return Value | | | | --- | --- | | string | The property name | ### mixed getPropertyValue(mixed $containingValue) Extracts the value of the property from the given container. #### Parameters | | | | | --- | --- | --- | | mixed | $containingValue | The container to extract the property value from | #### Return Value | | | | --- | --- | | mixed | The value of the property |
programming_docs
symfony ClassMetadataInterface ClassMetadataInterface ======================= interface **ClassMetadataInterface** implements [MetadataInterface](metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") Stores all metadata needed for validating objects of specific class. Most importantly, the metadata stores the constraints against which an object and its properties should be validated. Additionally, the metadata stores whether the "Default" group is overridden by a group sequence for that class and whether instances of that class should be traversed or not. Methods ------- | | | | | --- | --- | --- | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | from [MetadataInterface](metadatainterface#method_getCascadingStrategy "Symfony\Component\Validator\Mapping\MetadataInterface") | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | from [MetadataInterface](metadatainterface#method_getTraversalStrategy "Symfony\Component\Validator\Mapping\MetadataInterface") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | from [MetadataInterface](metadatainterface#method_getConstraints "Symfony\Component\Validator\Mapping\MetadataInterface") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | from [MetadataInterface](metadatainterface#method_findConstraints "Symfony\Component\Validator\Mapping\MetadataInterface") | | string[] | [getConstrainedProperties](#method_getConstrainedProperties)() Returns the names of all constrained properties. | | | bool | [hasGroupSequence](#method_hasGroupSequence)() Returns whether the "Default" group is overridden by a group sequence. | | | [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|null | [getGroupSequence](#method_getGroupSequence)() Returns the group sequence that overrides the "Default" group for this class. | | | bool | [isGroupSequenceProvider](#method_isGroupSequenceProvider)() Returns whether the "Default" group is overridden by a dynamic group sequence obtained by the validated objects. | | | bool | [hasPropertyMetadata](#method_hasPropertyMetadata)(string $property) Check if there's any metadata attached to the given named property. | | | [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")[] | [getPropertyMetadata](#method_getPropertyMetadata)(string $property) Returns all metadata instances for the given named property. | | | string | [getClassName](#method_getClassName)() Returns the name of the backing PHP class. | | Details ------- ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | #### See also | | | | --- | --- | | [CascadingStrategy](cascadingstrategy "Symfony\Component\Validator\Mapping\CascadingStrategy") | | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | #### See also | | | | --- | --- | | [TraversalStrategy](traversalstrategy "Symfony\Component\Validator\Mapping\TraversalStrategy") | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### string[] getConstrainedProperties() Returns the names of all constrained properties. #### Return Value | | | | --- | --- | | string[] | A list of property names | ### bool hasGroupSequence() Returns whether the "Default" group is overridden by a group sequence. If it is, you can access the group sequence with {@link getGroupSequence()}. #### Return Value | | | | --- | --- | | bool | Returns true if the "Default" group is overridden | #### See also | | | | --- | --- | | [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | | ### [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|null getGroupSequence() Returns the group sequence that overrides the "Default" group for this class. #### Return Value | | | | --- | --- | | [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|null | The group sequence or null | #### See also | | | | --- | --- | | [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | | ### bool isGroupSequenceProvider() Returns whether the "Default" group is overridden by a dynamic group sequence obtained by the validated objects. If this method returns true, the class must implement {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}. This interface will be used to obtain the group sequence when an object of this class is validated. #### Return Value | | | | --- | --- | | bool | Returns true if the "Default" group is overridden by a dynamic group sequence | #### See also | | | | --- | --- | | [GroupSequenceProviderInterface](../groupsequenceproviderinterface "Symfony\Component\Validator\GroupSequenceProviderInterface") | | ### bool hasPropertyMetadata(string $property) Check if there's any metadata attached to the given named property. #### Parameters | | | | | --- | --- | --- | | string | $property | The property name | #### Return Value | | | | --- | --- | | bool | | ### [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")[] getPropertyMetadata(string $property) Returns all metadata instances for the given named property. If your implementation does not support properties, simply throw an exception in this method (for example a BadMethodCallException). #### Parameters | | | | | --- | --- | --- | | string | $property | The property name | #### Return Value | | | | --- | --- | | [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")[] | A list of metadata instances. Empty if no metadata exists for the property. | ### string getClassName() Returns the name of the backing PHP class. #### Return Value | | | | --- | --- | | string | The name of the backing class | symfony ClassMetadata ClassMetadata ============== class **ClassMetadata** extends [GenericMetadata](genericmetadata "Symfony\Component\Validator\Mapping\GenericMetadata") implements [ClassMetadataInterface](classmetadatainterface "Symfony\Component\Validator\Mapping\ClassMetadataInterface") Default implementation of {@link ClassMetadataInterface}. This class supports serialization and cloning. Properties ---------- | | | | | | --- | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | | from [GenericMetadata](genericmetadata#property_constraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | array | $constraintsByGroup | | from [GenericMetadata](genericmetadata#property_constraintsByGroup "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $cascadingStrategy | The strategy for cascading objects. | from [GenericMetadata](genericmetadata#property_cascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $traversalStrategy | The strategy for traversing traversable objects. | | | string | $name | | | | string | $defaultGroup | | | | MemberMetadata[][] | $members | | | | [PropertyMetadata](propertymetadata "Symfony\Component\Validator\Mapping\PropertyMetadata")[] | $properties | | | | [GetterMetadata](gettermetadata "Symfony\Component\Validator\Mapping\GetterMetadata")[] | $getters | | | | array | $groupSequence | | | | bool | $groupSequenceProvider | | | Methods ------- | | | | | --- | --- | --- | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | | | | [\_\_clone](#method___clone)() Clones this object. | from [GenericMetadata](genericmetadata#method___clone "Symfony\Component\Validator\Mapping\GenericMetadata") | | $this | [addConstraint](#method_addConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. | | | $this | [addConstraints](#method_addConstraints)(array $constraints) Adds an list of constraints. | from [GenericMetadata](genericmetadata#method_addConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | from [GenericMetadata](genericmetadata#method_getConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | bool | [hasConstraints](#method_hasConstraints)() Returns whether this element has any constraints. | from [GenericMetadata](genericmetadata#method_hasConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | from [GenericMetadata](genericmetadata#method_findConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Class nodes are never cascaded. | | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#method_getTraversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | [\_\_construct](#method___construct)(string $class) | | | string | [getClassName](#method_getClassName)() Returns the name of the backing PHP class. | | | string | [getDefaultGroup](#method_getDefaultGroup)() Returns the name of the default group for this class. | | | $this | [addPropertyConstraint](#method_addPropertyConstraint)(string $property, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint to the given property. | | | $this | [addPropertyConstraints](#method_addPropertyConstraints)(string $property, array $constraints) | | | $this | [addGetterConstraint](#method_addGetterConstraint)(string $property, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint to the getter of the given property. | | | $this | [addGetterMethodConstraint](#method_addGetterMethodConstraint)(string $property, string $method, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint to the getter of the given property. | | | $this | [addGetterConstraints](#method_addGetterConstraints)(string $property, array $constraints) | | | $this | [addGetterMethodConstraints](#method_addGetterMethodConstraints)(string $property, string $method, array $constraints) | | | | [mergeConstraints](#method_mergeConstraints)([ClassMetadata](classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $source) Merges the constraints of the given metadata into this object. | | | bool | [hasPropertyMetadata](#method_hasPropertyMetadata)(string $property) Check if there's any metadata attached to the given named property. | | | [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")[] | [getPropertyMetadata](#method_getPropertyMetadata)(string $property) Returns all metadata instances for the given named property. | | | string[] | [getConstrainedProperties](#method_getConstrainedProperties)() Returns the names of all constrained properties. | | | $this | [setGroupSequence](#method_setGroupSequence)(string[]|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") $groupSequence) Sets the default group sequence for this class. | | | bool | [hasGroupSequence](#method_hasGroupSequence)() Returns whether the "Default" group is overridden by a group sequence. | | | [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|null | [getGroupSequence](#method_getGroupSequence)() Returns the group sequence that overrides the "Default" group for this class. | | | [ReflectionClass](http://php.net/ReflectionClass) | [getReflectionClass](#method_getReflectionClass)() Returns a ReflectionClass instance for this class. | | | | [setGroupSequenceProvider](#method_setGroupSequenceProvider)(bool $active) Sets whether a group sequence provider should be used. | | | bool | [isGroupSequenceProvider](#method_isGroupSequenceProvider)() Returns whether the "Default" group is overridden by a dynamic group sequence obtained by the validated objects. | | Details ------- ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | ### \_\_clone() Clones this object. ### $this addConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following: * {@link TraversalStrategy::IMPLICIT} if $traverse is enabled * {@link TraversalStrategy::NONE} if $traverse is disabled #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When trying to add the {@link Traverse} constraint | ### $this addConstraints(array $constraints) Adds an list of constraints. #### Parameters | | | | | --- | --- | --- | | array | $constraints | The constraints to add | #### Return Value | | | | --- | --- | | $this | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### bool hasConstraints() Returns whether this element has any constraints. #### Return Value | | | | --- | --- | | bool | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### int getCascadingStrategy() Class nodes are never cascaded. {@inheritdoc} #### Return Value | | | | --- | --- | | int | The cascading strategy | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | ### \_\_construct(string $class) #### Parameters | | | | | --- | --- | --- | | string | $class | | ### string getClassName() Returns the name of the backing PHP class. #### Return Value | | | | --- | --- | | string | The name of the backing class | ### string getDefaultGroup() Returns the name of the default group for this class. For each class, the group "Default" is an alias for the group "", where is the non-namespaced name of the class. All constraints implicitly or explicitly assigned to group "Default" belong to both of these groups, unless the class defines a group sequence. If a class defines a group sequence, validating the class in "Default" will validate the group sequence. The constraints assigned to "Default" can still be validated by validating the class in "". #### Return Value | | | | --- | --- | | string | The name of the default group | ### $this addPropertyConstraint(string $property, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint to the given property. #### Parameters | | | | | --- | --- | --- | | string | $property | The name of the property | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint | #### Return Value | | | | --- | --- | | $this | | ### $this addPropertyConstraints(string $property, array $constraints) #### Parameters | | | | | --- | --- | --- | | string | $property | | | array | $constraints | | #### Return Value | | | | --- | --- | | $this | | ### $this addGetterConstraint(string $property, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint to the getter of the given property. The name of the getter is assumed to be the name of the property with an uppercased first letter and either the prefix "get" or "is". #### Parameters | | | | | --- | --- | --- | | string | $property | The name of the property | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint | #### Return Value | | | | --- | --- | | $this | | ### $this addGetterMethodConstraint(string $property, string $method, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint to the getter of the given property. #### Parameters | | | | | --- | --- | --- | | string | $property | The name of the property | | string | $method | The name of the getter method | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint | #### Return Value | | | | --- | --- | | $this | | ### $this addGetterConstraints(string $property, array $constraints) #### Parameters | | | | | --- | --- | --- | | string | $property | | | array | $constraints | | #### Return Value | | | | --- | --- | | $this | | ### $this addGetterMethodConstraints(string $property, string $method, array $constraints) #### Parameters | | | | | --- | --- | --- | | string | $property | | | string | $method | | | array | $constraints | | #### Return Value | | | | --- | --- | | $this | | ### mergeConstraints([ClassMetadata](classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $source) Merges the constraints of the given metadata into this object. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $source | | ### bool hasPropertyMetadata(string $property) Check if there's any metadata attached to the given named property. #### Parameters | | | | | --- | --- | --- | | string | $property | The property name | #### Return Value | | | | --- | --- | | bool | | ### [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")[] getPropertyMetadata(string $property) Returns all metadata instances for the given named property. If your implementation does not support properties, simply throw an exception in this method (for example a BadMethodCallException). #### Parameters | | | | | --- | --- | --- | | string | $property | The property name | #### Return Value | | | | --- | --- | | [PropertyMetadataInterface](propertymetadatainterface "Symfony\Component\Validator\Mapping\PropertyMetadataInterface")[] | A list of metadata instances. Empty if no metadata exists for the property. | ### string[] getConstrainedProperties() Returns the names of all constrained properties. #### Return Value | | | | --- | --- | | string[] | A list of property names | ### $this setGroupSequence(string[]|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") $groupSequence) Sets the default group sequence for this class. #### Parameters | | | | | --- | --- | --- | | string[]|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | $groupSequence | An array of group names | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [GroupDefinitionException](../exception/groupdefinitionexception "Symfony\Component\Validator\Exception\GroupDefinitionException") | | ### bool hasGroupSequence() Returns whether the "Default" group is overridden by a group sequence. If it is, you can access the group sequence with {@link getGroupSequence()}. #### Return Value | | | | --- | --- | | bool | Returns true if the "Default" group is overridden | ### [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|null getGroupSequence() Returns the group sequence that overrides the "Default" group for this class. #### Return Value | | | | --- | --- | | [GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|null | The group sequence or null | ### [ReflectionClass](http://php.net/ReflectionClass) getReflectionClass() Returns a ReflectionClass instance for this class. #### Return Value | | | | --- | --- | | [ReflectionClass](http://php.net/ReflectionClass) | | ### setGroupSequenceProvider(bool $active) Sets whether a group sequence provider should be used. #### Parameters | | | | | --- | --- | --- | | bool | $active | | #### Exceptions | | | | --- | --- | | [GroupDefinitionException](../exception/groupdefinitionexception "Symfony\Component\Validator\Exception\GroupDefinitionException") | | ### bool isGroupSequenceProvider() Returns whether the "Default" group is overridden by a dynamic group sequence obtained by the validated objects. If this method returns true, the class must implement {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}. This interface will be used to obtain the group sequence when an object of this class is validated. #### Return Value | | | | --- | --- | | bool | Returns true if the "Default" group is overridden by a dynamic group sequence |
programming_docs
symfony CascadingStrategy CascadingStrategy ================== class **CascadingStrategy** Specifies whether an object should be cascaded. Cascading is relevant for any node type but class nodes. If such a node contains an object of value, and if cascading is enabled, then the node traverser will try to find class metadata for that object and validate the object against that metadata. If no metadata is found for a cascaded object, and if that object implements {@link \Traversable}, the node traverser will iterate over the object and cascade each object or collection contained within, unless iteration is prohibited by the specified {@link TraversalStrategy}. Although the constants currently represent a boolean switch, they are implemented as bit mask in order to allow future extensions. Constants --------- | | | | --- | --- | | NONE | *Specifies that a node should not be cascaded.* | | CASCADE | *Specifies that a node should be cascaded.* | symfony GetterMetadata GetterMetadata =============== class **GetterMetadata** extends [MemberMetadata](membermetadata "Symfony\Component\Validator\Mapping\MemberMetadata") Stores all metadata needed for validating a class property via its getter method. A property getter is any method that is equal to the property's name, prefixed with either "get" or "is". That method will be used to access the property's value. The getter will be invoked by reflection, so the access of private and protected getters is supported. This class supports serialization and cloning. Properties ---------- | | | | | | --- | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | | from [GenericMetadata](genericmetadata#property_constraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | array | $constraintsByGroup | | from [GenericMetadata](genericmetadata#property_constraintsByGroup "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $cascadingStrategy | The strategy for cascading objects. | from [GenericMetadata](genericmetadata#property_cascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | $traversalStrategy | The strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#property_traversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | $class | | from [MemberMetadata](membermetadata#property_class "Symfony\Component\Validator\Mapping\MemberMetadata") | | | $name | | from [MemberMetadata](membermetadata#property_name "Symfony\Component\Validator\Mapping\MemberMetadata") | | | $property | | from [MemberMetadata](membermetadata#property_property "Symfony\Component\Validator\Mapping\MemberMetadata") | Methods ------- | | | | | --- | --- | --- | | string[] | [\_\_sleep](#method___sleep)() Returns the names of the properties that should be serialized. | from [MemberMetadata](membermetadata#method___sleep "Symfony\Component\Validator\Mapping\MemberMetadata") | | | [\_\_clone](#method___clone)() Clones this object. | from [GenericMetadata](genericmetadata#method___clone "Symfony\Component\Validator\Mapping\GenericMetadata") | | $this | [addConstraint](#method_addConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. | from [MemberMetadata](membermetadata#method_addConstraint "Symfony\Component\Validator\Mapping\MemberMetadata") | | $this | [addConstraints](#method_addConstraints)(array $constraints) Adds an list of constraints. | from [GenericMetadata](genericmetadata#method_addConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [getConstraints](#method_getConstraints)() Returns all constraints of this element. | from [GenericMetadata](genericmetadata#method_getConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | bool | [hasConstraints](#method_hasConstraints)() Returns whether this element has any constraints. | from [GenericMetadata](genericmetadata#method_hasConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | [findConstraints](#method_findConstraints)(string $group) Returns all constraints for a given validation group. | from [GenericMetadata](genericmetadata#method_findConstraints "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getCascadingStrategy](#method_getCascadingStrategy)() Returns the strategy for cascading objects. | from [GenericMetadata](genericmetadata#method_getCascadingStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | int | [getTraversalStrategy](#method_getTraversalStrategy)() Returns the strategy for traversing traversable objects. | from [GenericMetadata](genericmetadata#method_getTraversalStrategy "Symfony\Component\Validator\Mapping\GenericMetadata") | | | [\_\_construct](#method___construct)(string $class, string $property, string $method = null) | | | string | [getName](#method_getName)() Returns the name of the member. | from [MemberMetadata](membermetadata#method_getName "Symfony\Component\Validator\Mapping\MemberMetadata") | | | [getClassName](#method_getClassName)() {@inheritdoc} | from [MemberMetadata](membermetadata#method_getClassName "Symfony\Component\Validator\Mapping\MemberMetadata") | | string | [getPropertyName](#method_getPropertyName)() Returns the name of the property. | from [MemberMetadata](membermetadata#method_getPropertyName "Symfony\Component\Validator\Mapping\MemberMetadata") | | bool | [isPublic](#method_isPublic)(object|string $objectOrClassName) Returns whether this member is public. | from [MemberMetadata](membermetadata#method_isPublic "Symfony\Component\Validator\Mapping\MemberMetadata") | | bool | [isProtected](#method_isProtected)(object|string $objectOrClassName) Returns whether this member is protected. | from [MemberMetadata](membermetadata#method_isProtected "Symfony\Component\Validator\Mapping\MemberMetadata") | | bool | [isPrivate](#method_isPrivate)(object|string $objectOrClassName) Returns whether this member is private. | from [MemberMetadata](membermetadata#method_isPrivate "Symfony\Component\Validator\Mapping\MemberMetadata") | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | [getReflectionMember](#method_getReflectionMember)(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. | from [MemberMetadata](membermetadata#method_getReflectionMember "Symfony\Component\Validator\Mapping\MemberMetadata") | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | [newReflectionMember](#method_newReflectionMember)(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. | | | mixed | [getPropertyValue](#method_getPropertyValue)($object) Extracts the value of the property from the given container. | | Details ------- ### string[] \_\_sleep() Returns the names of the properties that should be serialized. #### Return Value | | | | --- | --- | | string[] | | ### \_\_clone() Clones this object. ### $this addConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Adds a constraint. If the constraint {@link Valid} is added, the cascading strategy will be changed to {@link CascadingStrategy::CASCADE}. Depending on the $traverse property of that constraint, the traversal strategy will be set to one of the following: * {@link TraversalStrategy::IMPLICIT} if $traverse is enabled * {@link TraversalStrategy::NONE} if $traverse is disabled #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | #### Return Value | | | | --- | --- | | $this | | #### Exceptions | | | | --- | --- | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When trying to add the {@link Traverse} constraint | ### $this addConstraints(array $constraints) Adds an list of constraints. #### Parameters | | | | | --- | --- | --- | | array | $constraints | The constraints to add | #### Return Value | | | | --- | --- | | $this | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] getConstraints() Returns all constraints of this element. #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of Constraint instances | ### bool hasConstraints() Returns whether this element has any constraints. #### Return Value | | | | --- | --- | | bool | | ### [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] findConstraints(string $group) Returns all constraints for a given validation group. #### Parameters | | | | | --- | --- | --- | | string | $group | The validation group | #### Return Value | | | | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | A list of constraint instances | ### int getCascadingStrategy() Returns the strategy for cascading objects. #### Return Value | | | | --- | --- | | int | The cascading strategy | ### int getTraversalStrategy() Returns the strategy for traversing traversable objects. #### Return Value | | | | --- | --- | | int | The traversal strategy | ### \_\_construct(string $class, string $property, string $method = null) #### Parameters | | | | | --- | --- | --- | | string | $class | The name of the class this member is defined on | | string | $property | The property the member belongs to | | string | $method | The method that is called to retrieve the value being validated (null for auto-detection) | #### Exceptions | | | | --- | --- | | [ValidatorException](../exception/validatorexception "Symfony\Component\Validator\Exception\ValidatorException") | | ### string getName() Returns the name of the member. #### Return Value | | | | --- | --- | | string | | ### getClassName() {@inheritdoc} ### string getPropertyName() Returns the name of the property. #### Return Value | | | | --- | --- | | string | The property name | ### bool isPublic(object|string $objectOrClassName) Returns whether this member is public. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### bool isProtected(object|string $objectOrClassName) Returns whether this member is protected. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### bool isPrivate(object|string $objectOrClassName) Returns whether this member is private. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | bool | | ### [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) getReflectionMember(object|string $objectOrClassName) Returns the reflection instance for accessing the member's value. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | The reflection instance | ### protected [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) newReflectionMember(object|string $objectOrClassName) Creates a new reflection instance for accessing the member's value. Must be implemented by subclasses. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClassName | The object or the class name | #### Return Value | | | | --- | --- | | [ReflectionMethod](http://php.net/ReflectionMethod)|[ReflectionProperty](http://php.net/ReflectionProperty) | The reflection instance | ### mixed getPropertyValue($object) Extracts the value of the property from the given container. #### Parameters | | | | | --- | --- | --- | | | $object | | #### Return Value | | | | --- | --- | | mixed | The value of the property | symfony Psr6Cache Psr6Cache ========== class **Psr6Cache** implements [CacheInterface](cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") PSR-6 adapter. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(CacheItemPoolInterface $cacheItemPool) | | | | [has](#method_has)(string $class) Returns whether metadata for the given class exists in the cache. | | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false | [read](#method_read)(string $class) Returns the metadata for the given class from the cache. | | | | [write](#method_write)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Stores a class metadata in the cache. | | Details ------- ### \_\_construct(CacheItemPoolInterface $cacheItemPool) #### Parameters | | | | | --- | --- | --- | | CacheItemPoolInterface | $cacheItemPool | | ### has(string $class) Returns whether metadata for the given class exists in the cache. #### Parameters | | | | | --- | --- | --- | | string | $class | | ### [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false read(string $class) Returns the metadata for the given class from the cache. #### Parameters | | | | | --- | --- | --- | | string | $class | Class Name | #### Return Value | | | | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false | A ClassMetadata instance or false on miss | ### write([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Stores a class metadata in the cache. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | symfony DoctrineCache DoctrineCache ============== class **DoctrineCache** implements [CacheInterface](cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") Adapts a Doctrine cache to a CacheInterface. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(Cache $cache) | | | | [setCache](#method_setCache)(Cache $cache) | | | | [has](#method_has)(string $class) Returns whether metadata for the given class exists in the cache. | | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false | [read](#method_read)(string $class) Returns the metadata for the given class from the cache. | | | | [write](#method_write)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Stores a class metadata in the cache. | | Details ------- ### \_\_construct(Cache $cache) #### Parameters | | | | | --- | --- | --- | | Cache | $cache | | ### setCache(Cache $cache) #### Parameters | | | | | --- | --- | --- | | Cache | $cache | | ### has(string $class) Returns whether metadata for the given class exists in the cache. #### Parameters | | | | | --- | --- | --- | | string | $class | | ### [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false read(string $class) Returns the metadata for the given class from the cache. #### Parameters | | | | | --- | --- | --- | | string | $class | Class Name | #### Return Value | | | | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false | A ClassMetadata instance or false on miss | ### write([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Stores a class metadata in the cache. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | symfony CacheInterface CacheInterface =============== interface **CacheInterface** Persists ClassMetadata instances in a cache. Methods ------- | | | | | --- | --- | --- | | | [has](#method_has)(string $class) Returns whether metadata for the given class exists in the cache. | | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false | [read](#method_read)(string $class) Returns the metadata for the given class from the cache. | | | | [write](#method_write)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Stores a class metadata in the cache. | | Details ------- ### has(string $class) Returns whether metadata for the given class exists in the cache. #### Parameters | | | | | --- | --- | --- | | string | $class | | ### [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false read(string $class) Returns the metadata for the given class from the cache. #### Parameters | | | | | --- | --- | --- | | string | $class | Class Name | #### Return Value | | | | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")|false | A ClassMetadata instance or false on miss | ### write([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Stores a class metadata in the cache. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | symfony AbstractLoader AbstractLoader =============== abstract class **AbstractLoader** implements [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") Base loader for validation metadata. This loader supports the loading of constraints from Symfony's default namespace (see {@link DEFAULT\_NAMESPACE}) using the short class names of those constraints. Constraints can also be loaded using their fully qualified class names. At last, namespace aliases can be defined to load constraints with the syntax "alias:ShortName". Constants --------- | | | | --- | --- | | DEFAULT\_NAMESPACE | *The namespace to load constraints from by default.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $namespaces | | | Methods ------- | | | | | --- | --- | --- | | | [addNamespaceAlias](#method_addNamespaceAlias)(string $alias, string $namespace) Adds a namespace alias. | | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | [newConstraint](#method_newConstraint)(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. | | Details ------- ### protected addNamespaceAlias(string $alias, string $namespace) Adds a namespace alias. The namespace alias can be used to reference constraints from specific namespaces in {@link newConstraint()}: ``` $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); $constraint = $this->newConstraint('mynamespace:NotNull'); ``` #### Parameters | | | | | --- | --- | --- | | string | $alias | The alias | | string | $namespace | The PHP namespace | ### protected [Constraint](../../constraint "Symfony\Component\Validator\Constraint") newConstraint(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. #### Parameters | | | | | --- | --- | --- | | string | $name | The constraint name. Either a constraint relative to the default constraint namespace, or a fully qualified class name. Alternatively, the constraint may be preceded by a namespace alias and a colon. The namespace alias must have been defined using {@link addNamespaceAlias()}. | | mixed | $options | The constraint options | #### Return Value | | | | --- | --- | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the namespace prefix is undefined |
programming_docs
symfony XmlFilesLoader XmlFilesLoader =============== class **XmlFilesLoader** extends [FilesLoader](filesloader "Symfony\Component\Validator\Mapping\Loader\FilesLoader") Loads validation metadata from a list of XML files. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $loaders | | from [LoaderChain](loaderchain#property_loaders "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $paths) Creates a new loader. | from [FilesLoader](filesloader#method___construct "Symfony\Component\Validator\Mapping\Loader\FilesLoader") | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | from [LoaderChain](loaderchain#method_loadClassMetadata "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getLoaders](#method_getLoaders)() | from [LoaderChain](loaderchain#method_getLoaders "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getFileLoaders](#method_getFileLoaders)(array $paths) Returns an array of file loaders for the given file paths. | from [FilesLoader](filesloader#method_getFileLoaders "Symfony\Component\Validator\Mapping\Loader\FilesLoader") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | [getFileLoaderInstance](#method_getFileLoaderInstance)($file) Creates a loader for the given file path. | | Details ------- ### \_\_construct(array $paths) Creates a new loader. #### Parameters | | | | | --- | --- | --- | | array | $paths | An array of file paths | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | ### [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getLoaders() #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | | ### protected [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getFileLoaders(array $paths) Returns an array of file loaders for the given file paths. #### Parameters | | | | | --- | --- | --- | | array | $paths | An array of file paths | #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | The metadata loaders | ### [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") getFileLoaderInstance($file) Creates a loader for the given file path. #### Parameters | | | | | --- | --- | --- | | | $file | | #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | The created loader | symfony FileLoader FileLoader =========== abstract class **FileLoader** extends [AbstractLoader](abstractloader "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") Base loader for loading validation metadata from a file. Constants --------- | | | | --- | --- | | DEFAULT\_NAMESPACE | *The namespace to load constraints from by default.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $namespaces | | from [AbstractLoader](abstractloader#property_namespaces "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | protected | $file | | | Methods ------- | | | | | --- | --- | --- | | | [addNamespaceAlias](#method_addNamespaceAlias)(string $alias, string $namespace) Adds a namespace alias. | from [AbstractLoader](abstractloader#method_addNamespaceAlias "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | [newConstraint](#method_newConstraint)(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. | from [AbstractLoader](abstractloader#method_newConstraint "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | | [\_\_construct](#method___construct)(string $file) Creates a new loader. | | Details ------- ### protected addNamespaceAlias(string $alias, string $namespace) Adds a namespace alias. The namespace alias can be used to reference constraints from specific namespaces in {@link newConstraint()}: ``` $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); $constraint = $this->newConstraint('mynamespace:NotNull'); ``` #### Parameters | | | | | --- | --- | --- | | string | $alias | The alias | | string | $namespace | The PHP namespace | ### protected [Constraint](../../constraint "Symfony\Component\Validator\Constraint") newConstraint(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. #### Parameters | | | | | --- | --- | --- | | string | $name | The constraint name. Either a constraint relative to the default constraint namespace, or a fully qualified class name. Alternatively, the constraint may be preceded by a namespace alias and a colon. The namespace alias must have been defined using {@link addNamespaceAlias()}. | | mixed | $options | The constraint options | #### Return Value | | | | --- | --- | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the namespace prefix is undefined | ### \_\_construct(string $file) Creates a new loader. #### Parameters | | | | | --- | --- | --- | | string | $file | The mapping file to load | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the file does not exist or is not readable | symfony AnnotationLoader AnnotationLoader ================= class **AnnotationLoader** implements [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") Loads validation metadata using a Doctrine annotation {@link Reader}. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $reader | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(Reader $reader) | | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | | Details ------- ### \_\_construct(Reader $reader) #### Parameters | | | | | --- | --- | --- | | Reader | $reader | | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | symfony StaticMethodLoader StaticMethodLoader =================== class **StaticMethodLoader** implements [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") Loads validation metadata by calling a static method on the loaded class. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $methodName | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $methodName = 'loadValidatorMetadata') Creates a new loader. | | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | | Details ------- ### \_\_construct(string $methodName = 'loadValidatorMetadata') Creates a new loader. #### Parameters | | | | | --- | --- | --- | | string | $methodName | The name of the static method to call | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | symfony FilesLoader FilesLoader ============ abstract class **FilesLoader** extends [LoaderChain](loaderchain "Symfony\Component\Validator\Mapping\Loader\LoaderChain") Base loader for loading validation metadata from a list of files. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $loaders | | from [LoaderChain](loaderchain#property_loaders "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $paths) Creates a new loader. | | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | from [LoaderChain](loaderchain#method_loadClassMetadata "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getLoaders](#method_getLoaders)() | from [LoaderChain](loaderchain#method_getLoaders "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getFileLoaders](#method_getFileLoaders)(array $paths) Returns an array of file loaders for the given file paths. | | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | [getFileLoaderInstance](#method_getFileLoaderInstance)(string $path) Creates a loader for the given file path. | | Details ------- ### \_\_construct(array $paths) Creates a new loader. #### Parameters | | | | | --- | --- | --- | | array | $paths | An array of file paths | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | ### [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getLoaders() #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | | ### protected [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getFileLoaders(array $paths) Returns an array of file loaders for the given file paths. #### Parameters | | | | | --- | --- | --- | | array | $paths | An array of file paths | #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | The metadata loaders | ### abstract protected [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") getFileLoaderInstance(string $path) Creates a loader for the given file path. #### Parameters | | | | | --- | --- | --- | | string | $path | The file path | #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | The created loader | symfony YamlFilesLoader YamlFilesLoader ================ class **YamlFilesLoader** extends [FilesLoader](filesloader "Symfony\Component\Validator\Mapping\Loader\FilesLoader") Loads validation metadata from a list of YAML files. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $loaders | | from [LoaderChain](loaderchain#property_loaders "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $paths) Creates a new loader. | from [FilesLoader](filesloader#method___construct "Symfony\Component\Validator\Mapping\Loader\FilesLoader") | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | from [LoaderChain](loaderchain#method_loadClassMetadata "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getLoaders](#method_getLoaders)() | from [LoaderChain](loaderchain#method_getLoaders "Symfony\Component\Validator\Mapping\Loader\LoaderChain") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getFileLoaders](#method_getFileLoaders)(array $paths) Returns an array of file loaders for the given file paths. | from [FilesLoader](filesloader#method_getFileLoaders "Symfony\Component\Validator\Mapping\Loader\FilesLoader") | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | [getFileLoaderInstance](#method_getFileLoaderInstance)($file) Creates a loader for the given file path. | | Details ------- ### \_\_construct(array $paths) Creates a new loader. #### Parameters | | | | | --- | --- | --- | | array | $paths | An array of file paths | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | ### [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getLoaders() #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | | ### protected [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getFileLoaders(array $paths) Returns an array of file loaders for the given file paths. #### Parameters | | | | | --- | --- | --- | | array | $paths | An array of file paths | #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | The metadata loaders | ### [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") getFileLoaderInstance($file) Creates a loader for the given file path. #### Parameters | | | | | --- | --- | --- | | | $file | | #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | The created loader | symfony YamlFileLoader YamlFileLoader =============== class **YamlFileLoader** extends [FileLoader](fileloader "Symfony\Component\Validator\Mapping\Loader\FileLoader") Loads validation metadata from a YAML file. Constants --------- | | | | --- | --- | | DEFAULT\_NAMESPACE | *The namespace to load constraints from by default.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $namespaces | | from [AbstractLoader](abstractloader#property_namespaces "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | protected | $file | | from [FileLoader](fileloader#property_file "Symfony\Component\Validator\Mapping\Loader\FileLoader") | | protected array | $classes | An array of YAML class descriptions. | | Methods ------- | | | | | --- | --- | --- | | | [addNamespaceAlias](#method_addNamespaceAlias)(string $alias, string $namespace) Adds a namespace alias. | from [AbstractLoader](abstractloader#method_addNamespaceAlias "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | [newConstraint](#method_newConstraint)(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. | from [AbstractLoader](abstractloader#method_newConstraint "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | | [\_\_construct](#method___construct)(string $file) Creates a new loader. | from [FileLoader](fileloader#method___construct "Symfony\Component\Validator\Mapping\Loader\FileLoader") | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | | | string[] | [getMappedClasses](#method_getMappedClasses)() Return the names of the classes mapped in this file. | | | array | [parseNodes](#method_parseNodes)(array $nodes) Parses a collection of YAML nodes. | | Details ------- ### protected addNamespaceAlias(string $alias, string $namespace) Adds a namespace alias. The namespace alias can be used to reference constraints from specific namespaces in {@link newConstraint()}: ``` $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); $constraint = $this->newConstraint('mynamespace:NotNull'); ``` #### Parameters | | | | | --- | --- | --- | | string | $alias | The alias | | string | $namespace | The PHP namespace | ### protected [Constraint](../../constraint "Symfony\Component\Validator\Constraint") newConstraint(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. #### Parameters | | | | | --- | --- | --- | | string | $name | The constraint name. Either a constraint relative to the default constraint namespace, or a fully qualified class name. Alternatively, the constraint may be preceded by a namespace alias and a colon. The namespace alias must have been defined using {@link addNamespaceAlias()}. | | mixed | $options | The constraint options | #### Return Value | | | | --- | --- | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the namespace prefix is undefined | ### \_\_construct(string $file) Creates a new loader. #### Parameters | | | | | --- | --- | --- | | string | $file | The mapping file to load | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the file does not exist or is not readable | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | ### string[] getMappedClasses() Return the names of the classes mapped in this file. #### Return Value | | | | --- | --- | | string[] | The classes names | ### protected array parseNodes(array $nodes) Parses a collection of YAML nodes. #### Parameters | | | | | --- | --- | --- | | array | $nodes | The YAML nodes | #### Return Value | | | | --- | --- | | array | An array of values or Constraint instances |
programming_docs
symfony LoaderInterface LoaderInterface ================ interface **LoaderInterface** Loads validation metadata into {@link ClassMetadata} instances. Methods ------- | | | | | --- | --- | --- | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | | Details ------- ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | symfony LoaderChain LoaderChain ============ class **LoaderChain** implements [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") Loads validation metadata from multiple {@link LoaderInterface} instances. Pass the loaders when constructing the chain. Once {@link loadClassMetadata()} is called, that method will be called on all loaders in the chain. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $loaders | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $loaders) | | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | [getLoaders](#method_getLoaders)() | | Details ------- ### \_\_construct(array $loaders) #### Parameters | | | | | --- | --- | --- | | array | $loaders | The metadata loaders to use | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If any of the loaders has an invalid type | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | ### [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] getLoaders() #### Return Value | | | | --- | --- | | [LoaderInterface](loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface")[] | | symfony XmlFileLoader XmlFileLoader ============== class **XmlFileLoader** extends [FileLoader](fileloader "Symfony\Component\Validator\Mapping\Loader\FileLoader") Loads validation metadata from an XML file. Constants --------- | | | | --- | --- | | DEFAULT\_NAMESPACE | *The namespace to load constraints from by default.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $namespaces | | from [AbstractLoader](abstractloader#property_namespaces "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | protected | $file | | from [FileLoader](fileloader#property_file "Symfony\Component\Validator\Mapping\Loader\FileLoader") | | protected [SimpleXMLElement](http://php.net/SimpleXMLElement)[]|null | $classes | The XML nodes of the mapping file. | | Methods ------- | | | | | --- | --- | --- | | | [addNamespaceAlias](#method_addNamespaceAlias)(string $alias, string $namespace) Adds a namespace alias. | from [AbstractLoader](abstractloader#method_addNamespaceAlias "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | [newConstraint](#method_newConstraint)(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. | from [AbstractLoader](abstractloader#method_newConstraint "Symfony\Component\Validator\Mapping\Loader\AbstractLoader") | | | [\_\_construct](#method___construct)(string $file) Creates a new loader. | from [FileLoader](fileloader#method___construct "Symfony\Component\Validator\Mapping\Loader\FileLoader") | | bool | [loadClassMetadata](#method_loadClassMetadata)([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. | | | string[] | [getMappedClasses](#method_getMappedClasses)() Return the names of the classes mapped in this file. | | | array | [parseConstraints](#method_parseConstraints)([SimpleXMLElement](http://php.net/SimpleXMLElement) $nodes) Parses a collection of "constraint" XML nodes. | | | array | [parseValues](#method_parseValues)([SimpleXMLElement](http://php.net/SimpleXMLElement) $nodes) Parses a collection of "value" XML nodes. | | | array | [parseOptions](#method_parseOptions)([SimpleXMLElement](http://php.net/SimpleXMLElement) $nodes) Parses a collection of "option" XML nodes. | | | [SimpleXMLElement](http://php.net/SimpleXMLElement) | [parseFile](#method_parseFile)(string $path) Loads the XML class descriptions from the given file. | | Details ------- ### protected addNamespaceAlias(string $alias, string $namespace) Adds a namespace alias. The namespace alias can be used to reference constraints from specific namespaces in {@link newConstraint()}: ``` $this->addNamespaceAlias('mynamespace', '\\Acme\\Package\\Constraints\\'); $constraint = $this->newConstraint('mynamespace:NotNull'); ``` #### Parameters | | | | | --- | --- | --- | | string | $alias | The alias | | string | $namespace | The PHP namespace | ### protected [Constraint](../../constraint "Symfony\Component\Validator\Constraint") newConstraint(string $name, mixed $options = null) Creates a new constraint instance for the given constraint name. #### Parameters | | | | | --- | --- | --- | | string | $name | The constraint name. Either a constraint relative to the default constraint namespace, or a fully qualified class name. Alternatively, the constraint may be preceded by a namespace alias and a colon. The namespace alias must have been defined using {@link addNamespaceAlias()}. | | mixed | $options | The constraint options | #### Return Value | | | | --- | --- | | [Constraint](../../constraint "Symfony\Component\Validator\Constraint") | | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the namespace prefix is undefined | ### \_\_construct(string $file) Creates a new loader. #### Parameters | | | | | --- | --- | --- | | string | $file | The mapping file to load | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the file does not exist or is not readable | ### bool loadClassMetadata([ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") $metadata) Loads validation metadata into a {@link ClassMetadata} instance. #### Parameters | | | | | --- | --- | --- | | [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata") | $metadata | | #### Return Value | | | | --- | --- | | bool | Whether the loader succeeded | ### string[] getMappedClasses() Return the names of the classes mapped in this file. #### Return Value | | | | --- | --- | | string[] | The classes names | ### protected array parseConstraints([SimpleXMLElement](http://php.net/SimpleXMLElement) $nodes) Parses a collection of "constraint" XML nodes. #### Parameters | | | | | --- | --- | --- | | [SimpleXMLElement](http://php.net/SimpleXMLElement) | $nodes | The XML nodes | #### Return Value | | | | --- | --- | | array | The Constraint instances | ### protected array parseValues([SimpleXMLElement](http://php.net/SimpleXMLElement) $nodes) Parses a collection of "value" XML nodes. #### Parameters | | | | | --- | --- | --- | | [SimpleXMLElement](http://php.net/SimpleXMLElement) | $nodes | The XML nodes | #### Return Value | | | | --- | --- | | array | The values | ### protected array parseOptions([SimpleXMLElement](http://php.net/SimpleXMLElement) $nodes) Parses a collection of "option" XML nodes. #### Parameters | | | | | --- | --- | --- | | [SimpleXMLElement](http://php.net/SimpleXMLElement) | $nodes | The XML nodes | #### Return Value | | | | --- | --- | | array | The options | ### protected [SimpleXMLElement](http://php.net/SimpleXMLElement) parseFile(string $path) Loads the XML class descriptions from the given file. #### Parameters | | | | | --- | --- | --- | | string | $path | The path of the XML file | #### Return Value | | | | --- | --- | | [SimpleXMLElement](http://php.net/SimpleXMLElement) | The class descriptions | #### Exceptions | | | | --- | --- | | [MappingException](../../exception/mappingexception "Symfony\Component\Validator\Exception\MappingException") | If the file could not be loaded | symfony LazyLoadingMetadataFactory LazyLoadingMetadataFactory =========================== class **LazyLoadingMetadataFactory** implements [MetadataFactoryInterface](metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") Creates new {@link ClassMetadataInterface} instances. Whenever {@link getMetadataFor()} is called for the first time with a given class name or object of that class, a new metadata instance is created and returned. On subsequent requests for the same class, the same metadata instance will be returned. You can optionally pass a {@link LoaderInterface} instance to the constructor. Whenever a new metadata instance is created, it is passed to the loader, which can configure the metadata based on configuration loaded from the filesystem or a database. If you want to use multiple loaders, wrap them in a {@link LoaderChain}. You can also optionally pass a {@link CacheInterface} instance to the constructor. This cache will be used for persisting the generated metadata between multiple PHP requests. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $loader | | | | protected | $cache | | | | protected [ClassMetadata](../classmetadata "Symfony\Component\Validator\Mapping\ClassMetadata")[] | $loadedClasses | The loaded metadata, indexed by class name. | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([LoaderInterface](../loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") $loader = null, [CacheInterface](../cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") $cache = null) Creates a new metadata factory. | | | [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | [getMetadataFor](#method_getMetadataFor)(mixed $value) Returns the metadata for the given value. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Returns whether the class is able to return metadata for the given value. | | Details ------- ### \_\_construct([LoaderInterface](../loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") $loader = null, [CacheInterface](../cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") $cache = null) Creates a new metadata factory. #### Parameters | | | | | --- | --- | --- | | [LoaderInterface](../loader/loaderinterface "Symfony\Component\Validator\Mapping\Loader\LoaderInterface") | $loader | The loader for configuring new metadata | | [CacheInterface](../cache/cacheinterface "Symfony\Component\Validator\Mapping\Cache\CacheInterface") | $cache | The cache for persisting metadata between multiple PHP requests | ### [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") getMetadataFor(mixed $value) Returns the metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | The metadata for the value | #### Exceptions | | | | --- | --- | | [NoSuchMetadataException](../../exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | If no metadata exists for the given value | ### bool hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | bool | Whether metadata can be returned for that value | symfony BlackHoleMetadataFactory BlackHoleMetadataFactory ========================= class **BlackHoleMetadataFactory** implements [MetadataFactoryInterface](metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") Metadata factory that does not store metadata. This implementation is useful if you want to validate values against constraints only and you don't need to add constraints to classes and properties. Methods ------- | | | | | --- | --- | --- | | [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | [getMetadataFor](#method_getMetadataFor)(mixed $value) Returns the metadata for the given value. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Returns whether the class is able to return metadata for the given value. | | Details ------- ### [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") getMetadataFor(mixed $value) Returns the metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | The metadata for the value | #### Exceptions | | | | --- | --- | | [NoSuchMetadataException](../../exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | If no metadata exists for the given value | ### bool hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | bool | Whether metadata can be returned for that value | symfony MetadataFactoryInterface MetadataFactoryInterface ========================= interface **MetadataFactoryInterface** Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. Methods ------- | | | | | --- | --- | --- | | [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | [getMetadataFor](#method_getMetadataFor)(mixed $value) Returns the metadata for the given value. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Returns whether the class is able to return metadata for the given value. | | Details ------- ### [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") getMetadataFor(mixed $value) Returns the metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | [MetadataInterface](../metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | The metadata for the value | #### Exceptions | | | | --- | --- | | [NoSuchMetadataException](../../exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | If no metadata exists for the given value | ### bool hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | bool | Whether metadata can be returned for that value | symfony ExecutionContextFactory ExecutionContextFactory ======================== class **ExecutionContextFactory** implements [ExecutionContextFactoryInterface](executioncontextfactoryinterface "Symfony\Component\Validator\Context\ExecutionContextFactoryInterface") Creates new {@link ExecutionContext} instances. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, string $translationDomain = null) Creates a new context factory. | | | [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | [createContext](#method_createContext)([ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, mixed $root) Creates a new execution context. | | Details ------- ### \_\_construct([TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, string $translationDomain = null) Creates a new context factory. #### Parameters | | | | | --- | --- | --- | | [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | The translator | | string | $translationDomain | The translation domain to use for translating violation messages | ### [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") createContext([ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, mixed $root) Creates a new execution context. #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | The validator | | mixed | $root | The root value of the validated object graph | #### Return Value | | | | --- | --- | | [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | The new execution context | symfony ExecutionContext ExecutionContext ================= class **ExecutionContext** implements [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") The context used and created by {@link ExecutionContextFactory}. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, mixed $root, [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, string $translationDomain = null) Creates a new execution context. | | | | [setNode](#method_setNode)(mixed $value, object|null $object, [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") $metadata = null, string $propertyPath) Sets the currently validated value. | | | | [setGroup](#method_setGroup)(string|null $group) Sets the currently validated group. | | | | [setConstraint](#method_setConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Sets the currently validated constraint. | | | | [addViolation](#method_addViolation)(string $message, array $parameters = array()) Adds a violation at the current node of the validation graph. | | | [ConstraintViolationBuilderInterface](../violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") | [buildViolation](#method_buildViolation)(string $message, array $parameters = array()) Returns a builder for adding a violation with extended information. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [getViolations](#method_getViolations)() Returns the violations generated by the validator so far. | | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | [getValidator](#method_getValidator)() Returns the validator. | | | mixed | [getRoot](#method_getRoot)() Returns the value at which validation was started in the object graph. | | | mixed | [getValue](#method_getValue)() Returns the value that the validator is currently validating. | | | object|null | [getObject](#method_getObject)() Returns the currently validated object. | | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")|null | [getMetadata](#method_getMetadata)() Returns the metadata for the currently validated value. | | | string | [getGroup](#method_getGroup)() Returns the validation group that is currently being validated. | | | | [getConstraint](#method_getConstraint)() | | | string|null | [getClassName](#method_getClassName)() Returns the class name of the current node. | | | string|null | [getPropertyName](#method_getPropertyName)() Returns the property name of the current node. | | | string | [getPropertyPath](#method_getPropertyPath)(string $subPath = '') Returns the property path to the value that the validator is currently validating. | | | | [markGroupAsValidated](#method_markGroupAsValidated)(string $cacheKey, string $groupHash) Marks an object as validated in a specific validation group. | | | bool | [isGroupValidated](#method_isGroupValidated)(string $cacheKey, string $groupHash) Returns whether an object was validated in a specific validation group. | | | | [markConstraintAsValidated](#method_markConstraintAsValidated)(string $cacheKey, string $constraintHash) Marks a constraint as validated for an object. | | | bool | [isConstraintValidated](#method_isConstraintValidated)(string $cacheKey, string $constraintHash) Returns whether a constraint was validated for an object. | | | | [markObjectAsInitialized](#method_markObjectAsInitialized)(string $cacheKey) Marks that an object was initialized. | | | bool | [isObjectInitialized](#method_isObjectInitialized)(string $cacheKey) Returns whether an object was initialized. | | Details ------- ### \_\_construct([ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, mixed $root, [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, string $translationDomain = null) Creates a new execution context. #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | The validator | | mixed | $root | The root value of the validated object graph | | [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | The translator | | string | $translationDomain | The translation domain to use for translating violation messages | ### setNode(mixed $value, object|null $object, [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") $metadata = null, string $propertyPath) Sets the currently validated value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The validated value | | object|null | $object | The currently validated object | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | $metadata | The validation metadata | | string | $propertyPath | The property path to the current value | ### setGroup(string|null $group) Sets the currently validated group. #### Parameters | | | | | --- | --- | --- | | string|null | $group | The validated group | ### setConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Sets the currently validated constraint. #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The validated constraint | ### addViolation(string $message, array $parameters = array()) Adds a violation at the current node of the validation graph. #### Parameters | | | | | --- | --- | --- | | string | $message | The error message | | array | $parameters | | ### [ConstraintViolationBuilderInterface](../violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") buildViolation(string $message, array $parameters = array()) Returns a builder for adding a violation with extended information. Call {@link ConstraintViolationBuilderInterface::addViolation()} to add the violation when you're done with the configuration: ``` $context->buildViolation('Please enter a number between %min% and %max%.') ->setParameter('%min%', 3) ->setParameter('%max%', 10) ->setTranslationDomain('number_validation') ->addViolation(); ``` #### Parameters | | | | | --- | --- | --- | | string | $message | The error message | | array | $parameters | The parameters substituted in the error message | #### Return Value | | | | --- | --- | | [ConstraintViolationBuilderInterface](../violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") | The violation builder | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") getViolations() Returns the violations generated by the validator so far. #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | The constraint violation list | ### [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") getValidator() Returns the validator. Useful if you want to validate additional constraints: ``` public function validate($value, Constraint $constraint) { $validator = $this->context->getValidator(); $violations = $validator->validate($value, new Length(array('min' => 3))); if (count($violations) > 0) { // ... } } ``` #### Return Value | | | | --- | --- | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | | ### mixed getRoot() Returns the value at which validation was started in the object graph. The validator, when given an object, traverses the properties and related objects and their properties. The root of the validation is the object from which the traversal started. The current value is returned by {@link getValue}. #### Return Value | | | | --- | --- | | mixed | The root value of the validation | ### mixed getValue() Returns the value that the validator is currently validating. If you want to retrieve the object that was originally passed to the validator, use {@link getRoot}. #### Return Value | | | | --- | --- | | mixed | The currently validated value | ### object|null getObject() Returns the currently validated object. If the validator is currently validating a class constraint, the object of that class is returned. If it is a validating a property or getter constraint, the object that the property/getter belongs to is returned. In other cases, null is returned. #### Return Value | | | | --- | --- | | object|null | The currently validated object or null | ### [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")|null getMetadata() Returns the metadata for the currently validated value. With the core implementation, this method returns a {@link Mapping\ClassMetadataInterface} instance if the current value is an object, a {@link Mapping\PropertyMetadata} instance if the current value is the value of a property and a {@link Mapping\GetterMetadata} instance if the validated value is the result of a getter method. If the validated value is neither of these, for example if the validator has been called with a plain value and constraint, this method returns null. #### Return Value | | | | --- | --- | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")|null | the metadata of the currently validated value | ### string getGroup() Returns the validation group that is currently being validated. #### Return Value | | | | --- | --- | | string | The current validation group | ### getConstraint() ### string|null getClassName() Returns the class name of the current node. If the metadata of the current node does not implement {@link Mapping\ClassMetadataInterface} or if no metadata is available for the current node, this method returns null. #### Return Value | | | | --- | --- | | string|null | The class name or null, if no class name could be found | ### string|null getPropertyName() Returns the property name of the current node. If the metadata of the current node does not implement {@link PropertyMetadataInterface} or if no metadata is available for the current node, this method returns null. #### Return Value | | | | --- | --- | | string|null | The property name or null, if no property name could be found | ### string getPropertyPath(string $subPath = '') Returns the property path to the value that the validator is currently validating. For example, take the following object graph: ``` (Person)---($address: Address)---($street: string) ``` When the Person instance is passed to the validator, the property path is initially empty. When the $address property of that person is validated, the property path is "address". When the $street property of the related Address instance is validated, the property path is "address.street". Properties of objects are prefixed with a dot in the property path. Indices of arrays or objects implementing the {@link \ArrayAccess} interface are enclosed in brackets. For example, if the property in the previous example is $addresses and contains an array of Address instance, the property path generated for the $street property of one of these addresses is for example "addresses[0].street". #### Parameters | | | | | --- | --- | --- | | string | $subPath | Optional. The suffix appended to the current property path. | #### Return Value | | | | --- | --- | | string | The current property path. The result may be an empty string if the validator is currently validating the root value of the validation graph. | ### markGroupAsValidated(string $cacheKey, string $groupHash) Marks an object as validated in a specific validation group. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $groupHash | The group's name or hash, if it is group sequence | ### bool isGroupValidated(string $cacheKey, string $groupHash) Returns whether an object was validated in a specific validation group. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $groupHash | The group's name or hash, if it is group sequence | #### Return Value | | | | --- | --- | | bool | Whether the object was already validated for that group | ### markConstraintAsValidated(string $cacheKey, string $constraintHash) Marks a constraint as validated for an object. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $constraintHash | The hash of the constraint | ### bool isConstraintValidated(string $cacheKey, string $constraintHash) Returns whether a constraint was validated for an object. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $constraintHash | The hash of the constraint | #### Return Value | | | | --- | --- | | bool | Whether the constraint was already validated | ### markObjectAsInitialized(string $cacheKey) Marks that an object was initialized. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | ### bool isObjectInitialized(string $cacheKey) Returns whether an object was initialized. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | #### Return Value | | | | --- | --- | | bool | Whether the object was already initialized |
programming_docs
symfony ExecutionContextInterface ExecutionContextInterface ========================== interface **ExecutionContextInterface** The context of a validation run. The context collects all violations generated during the validation. By default, validators execute all validations in a new context: ``` $violations = $validator->validate($object); ``` When you make another call to the validator, while the validation is in progress, the violations will be isolated from each other: ``` public function validate($value, Constraint $constraint) { $validator = $this->context->getValidator(); // The violations are not added to $this->context $violations = $validator->validate($value); } ``` However, if you want to add the violations to the current context, use the {@link ValidatorInterface::inContext()} method: ``` public function validate($value, Constraint $constraint) { $validator = $this->context->getValidator(); // The violations are added to $this->context $validator ->inContext($this->context) ->validate($value) ; } ``` Additionally, the context provides information about the current state of the validator, such as the currently validated class, the name of the currently validated property and more. These values change over time, so you cannot store a context and expect that the methods still return the same results later on. Methods ------- | | | | | --- | --- | --- | | | [addViolation](#method_addViolation)(string $message, array $params = array()) Adds a violation at the current node of the validation graph. | | | [ConstraintViolationBuilderInterface](../violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") | [buildViolation](#method_buildViolation)(string $message, array $parameters = array()) Returns a builder for adding a violation with extended information. | | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | [getValidator](#method_getValidator)() Returns the validator. | | | object|null | [getObject](#method_getObject)() Returns the currently validated object. | | | | [setNode](#method_setNode)(mixed $value, object|null $object, [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") $metadata = null, string $propertyPath) Sets the currently validated value. | | | | [setGroup](#method_setGroup)(string|null $group) Sets the currently validated group. | | | | [setConstraint](#method_setConstraint)([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Sets the currently validated constraint. | | | | [markGroupAsValidated](#method_markGroupAsValidated)(string $cacheKey, string $groupHash) Marks an object as validated in a specific validation group. | | | bool | [isGroupValidated](#method_isGroupValidated)(string $cacheKey, string $groupHash) Returns whether an object was validated in a specific validation group. | | | | [markConstraintAsValidated](#method_markConstraintAsValidated)(string $cacheKey, string $constraintHash) Marks a constraint as validated for an object. | | | bool | [isConstraintValidated](#method_isConstraintValidated)(string $cacheKey, string $constraintHash) Returns whether a constraint was validated for an object. | | | | [markObjectAsInitialized](#method_markObjectAsInitialized)(string $cacheKey) Marks that an object was initialized. | | | bool | [isObjectInitialized](#method_isObjectInitialized)(string $cacheKey) Returns whether an object was initialized. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [getViolations](#method_getViolations)() Returns the violations generated by the validator so far. | | | mixed | [getRoot](#method_getRoot)() Returns the value at which validation was started in the object graph. | | | mixed | [getValue](#method_getValue)() Returns the value that the validator is currently validating. | | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")|null | [getMetadata](#method_getMetadata)() Returns the metadata for the currently validated value. | | | string | [getGroup](#method_getGroup)() Returns the validation group that is currently being validated. | | | string|null | [getClassName](#method_getClassName)() Returns the class name of the current node. | | | string|null | [getPropertyName](#method_getPropertyName)() Returns the property name of the current node. | | | string | [getPropertyPath](#method_getPropertyPath)(string $subPath = '') Returns the property path to the value that the validator is currently validating. | | Details ------- ### addViolation(string $message, array $params = array()) Adds a violation at the current node of the validation graph. #### Parameters | | | | | --- | --- | --- | | string | $message | The error message | | array | $params | The parameters substituted in the error message | ### [ConstraintViolationBuilderInterface](../violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") buildViolation(string $message, array $parameters = array()) Returns a builder for adding a violation with extended information. Call {@link ConstraintViolationBuilderInterface::addViolation()} to add the violation when you're done with the configuration: ``` $context->buildViolation('Please enter a number between %min% and %max%.') ->setParameter('%min%', 3) ->setParameter('%max%', 10) ->setTranslationDomain('number_validation') ->addViolation(); ``` #### Parameters | | | | | --- | --- | --- | | string | $message | The error message | | array | $parameters | The parameters substituted in the error message | #### Return Value | | | | --- | --- | | [ConstraintViolationBuilderInterface](../violation/constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") | The violation builder | ### [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") getValidator() Returns the validator. Useful if you want to validate additional constraints: ``` public function validate($value, Constraint $constraint) { $validator = $this->context->getValidator(); $violations = $validator->validate($value, new Length(array('min' => 3))); if (count($violations) > 0) { // ... } } ``` #### Return Value | | | | --- | --- | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | | ### object|null getObject() Returns the currently validated object. If the validator is currently validating a class constraint, the object of that class is returned. If it is a validating a property or getter constraint, the object that the property/getter belongs to is returned. In other cases, null is returned. #### Return Value | | | | --- | --- | | object|null | The currently validated object or null | ### setNode(mixed $value, object|null $object, [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") $metadata = null, string $propertyPath) Sets the currently validated value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The validated value | | object|null | $object | The currently validated object | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | $metadata | The validation metadata | | string | $propertyPath | The property path to the current value | ### setGroup(string|null $group) Sets the currently validated group. #### Parameters | | | | | --- | --- | --- | | string|null | $group | The validated group | ### setConstraint([Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Sets the currently validated constraint. #### Parameters | | | | | --- | --- | --- | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The validated constraint | ### markGroupAsValidated(string $cacheKey, string $groupHash) Marks an object as validated in a specific validation group. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $groupHash | The group's name or hash, if it is group sequence | ### bool isGroupValidated(string $cacheKey, string $groupHash) Returns whether an object was validated in a specific validation group. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $groupHash | The group's name or hash, if it is group sequence | #### Return Value | | | | --- | --- | | bool | Whether the object was already validated for that group | ### markConstraintAsValidated(string $cacheKey, string $constraintHash) Marks a constraint as validated for an object. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $constraintHash | The hash of the constraint | ### bool isConstraintValidated(string $cacheKey, string $constraintHash) Returns whether a constraint was validated for an object. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | | string | $constraintHash | The hash of the constraint | #### Return Value | | | | --- | --- | | bool | Whether the constraint was already validated | ### markObjectAsInitialized(string $cacheKey) Marks that an object was initialized. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | #### See also | | | | --- | --- | | ObjectInitializerInterface | | ### bool isObjectInitialized(string $cacheKey) Returns whether an object was initialized. #### Parameters | | | | | --- | --- | --- | | string | $cacheKey | The hash of the object | #### Return Value | | | | --- | --- | | bool | Whether the object was already initialized | #### See also | | | | --- | --- | | ObjectInitializerInterface | | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") getViolations() Returns the violations generated by the validator so far. #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | The constraint violation list | ### mixed getRoot() Returns the value at which validation was started in the object graph. The validator, when given an object, traverses the properties and related objects and their properties. The root of the validation is the object from which the traversal started. The current value is returned by {@link getValue}. #### Return Value | | | | --- | --- | | mixed | The root value of the validation | ### mixed getValue() Returns the value that the validator is currently validating. If you want to retrieve the object that was originally passed to the validator, use {@link getRoot}. #### Return Value | | | | --- | --- | | mixed | The currently validated value | ### [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")|null getMetadata() Returns the metadata for the currently validated value. With the core implementation, this method returns a {@link Mapping\ClassMetadataInterface} instance if the current value is an object, a {@link Mapping\PropertyMetadata} instance if the current value is the value of a property and a {@link Mapping\GetterMetadata} instance if the validated value is the result of a getter method. If the validated value is neither of these, for example if the validator has been called with a plain value and constraint, this method returns null. #### Return Value | | | | --- | --- | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface")|null | the metadata of the currently validated value | ### string getGroup() Returns the validation group that is currently being validated. #### Return Value | | | | --- | --- | | string | The current validation group | ### string|null getClassName() Returns the class name of the current node. If the metadata of the current node does not implement {@link Mapping\ClassMetadataInterface} or if no metadata is available for the current node, this method returns null. #### Return Value | | | | --- | --- | | string|null | The class name or null, if no class name could be found | ### string|null getPropertyName() Returns the property name of the current node. If the metadata of the current node does not implement {@link PropertyMetadataInterface} or if no metadata is available for the current node, this method returns null. #### Return Value | | | | --- | --- | | string|null | The property name or null, if no property name could be found | ### string getPropertyPath(string $subPath = '') Returns the property path to the value that the validator is currently validating. For example, take the following object graph: ``` (Person)---($address: Address)---($street: string) ``` When the Person instance is passed to the validator, the property path is initially empty. When the $address property of that person is validated, the property path is "address". When the $street property of the related Address instance is validated, the property path is "address.street". Properties of objects are prefixed with a dot in the property path. Indices of arrays or objects implementing the {@link \ArrayAccess} interface are enclosed in brackets. For example, if the property in the previous example is $addresses and contains an array of Address instance, the property path generated for the $street property of one of these addresses is for example "addresses[0].street". #### Parameters | | | | | --- | --- | --- | | string | $subPath | Optional. The suffix appended to the current property path. | #### Return Value | | | | --- | --- | | string | The current property path. The result may be an empty string if the validator is currently validating the root value of the validation graph. | symfony ExecutionContextFactoryInterface ExecutionContextFactoryInterface ================================= interface **ExecutionContextFactoryInterface** Creates instances of {@link ExecutionContextInterface}. You can use a custom factory if you want to customize the execution context that is passed through the validation run. Methods ------- | | | | | --- | --- | --- | | [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | [createContext](#method_createContext)([ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, mixed $root) Creates a new execution context. | | Details ------- ### [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") createContext([ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator, mixed $root) Creates a new execution context. #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](../validator/validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | The validator | | mixed | $root | The root value of the validated object graph | #### Return Value | | | | --- | --- | | [ExecutionContextInterface](executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | The new execution context | symfony RecursiveContextualValidator RecursiveContextualValidator ============================= class **RecursiveContextualValidator** implements [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") Recursive implementation of {@link ContextualValidatorInterface}. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context, [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory, [ConstraintValidatorFactoryInterface](../constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory, array $objectInitializers = array()) Creates a validator for the given context. | | | $this | [atPath](#method_atPath)(string $path) Appends the given path to the property path of the context. | | | $this | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. | | | $this | [validateProperty](#method_validateProperty)(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. | | | $this | [validatePropertyValue](#method_validatePropertyValue)(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [getViolations](#method_getViolations)() Returns the violations that have been generated so far in the context of the validator. | | | (string|GroupSequence)[] | [normalizeGroups](#method_normalizeGroups)(string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[] $groups) Normalizes the given group or list of groups to an array. | | Details ------- ### \_\_construct([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context, [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory, [ConstraintValidatorFactoryInterface](../constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory, array $objectInitializers = array()) Creates a validator for the given context. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The execution context | | [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | $metadataFactory | The factory for fetching the metadata of validated objects | | [ConstraintValidatorFactoryInterface](../constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") | $validatorFactory | The factory for creating constraint validators | | array | $objectInitializers | The object initializers | ### $this atPath(string $path) Appends the given path to the property path of the context. If called multiple times, the path will always be reset to the context's original path with the given path appended to it. #### Parameters | | | | | --- | --- | --- | | string | $path | The path to append | #### Return Value | | | | --- | --- | | $this | | ### $this validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to validate | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | The constraint(s) to validate against | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | $this | | ### $this validateProperty(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. #### Parameters | | | | | --- | --- | --- | | object | $object | The object | | string | $propertyName | The name of the validated property | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | $this | | ### $this validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClass | The object or its class name | | string | $propertyName | The name of the property | | mixed | $value | The value to validate against the property's constraints | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | $this | | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") getViolations() Returns the violations that have been generated so far in the context of the validator. #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | The constraint violations | ### protected (string|GroupSequence)[] normalizeGroups(string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[] $groups) Normalizes the given group or list of groups to an array. #### Parameters | | | | | --- | --- | --- | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[] | $groups | The groups to normalize | #### Return Value | | | | --- | --- | | (string|GroupSequence)[] | A group array |
programming_docs
symfony TraceableValidator TraceableValidator =================== class **TraceableValidator** implements [ValidatorInterface](validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") Collects some data about validator calls. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ValidatorInterface](validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator) | | | array | [getCollectedData](#method_getCollectedData)() | | | | [reset](#method_reset)() | | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | [getMetadataFor](#method_getMetadataFor)(mixed $value) Returns the metadata for the given value. | | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Returns whether the class is able to return metadata for the given value. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validateProperty](#method_validateProperty)(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validatePropertyValue](#method_validatePropertyValue)(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. | | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | [startContext](#method_startContext)() Starts a new validation context and returns a validator for that context. | | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | [inContext](#method_inContext)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Returns a validator in the given execution context. | | Details ------- ### \_\_construct([ValidatorInterface](validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") $validator) #### Parameters | | | | | --- | --- | --- | | [ValidatorInterface](validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") | $validator | | ### array getCollectedData() #### Return Value | | | | --- | --- | | array | | ### reset() ### [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") getMetadataFor(mixed $value) Returns the metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | The metadata for the value | #### Exceptions | | | | --- | --- | | [NoSuchMetadataException](../exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | If no metadata exists for the given value | ### bool hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | bool | Whether metadata can be returned for that value | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to validate | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | The constraint(s) to validate against | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validateProperty(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. #### Parameters | | | | | --- | --- | --- | | object | $object | The object | | string | $propertyName | The name of the validated property | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClass | The object or its class name | | string | $propertyName | The name of the property | | mixed | $value | The value to validate against the property's constraints | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") startContext() Starts a new validation context and returns a validator for that context. The returned validator collects all violations generated within its context. You can access these violations with the {@link ContextualValidatorInterface::getViolations()} method. #### Return Value | | | | --- | --- | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | The validator for the new context | ### [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") inContext([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Returns a validator in the given execution context. The returned validator adds all generated violations to the given context. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | #### Return Value | | | | --- | --- | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | The validator for that context | symfony ValidatorInterface ValidatorInterface =================== interface **ValidatorInterface** implements [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") Validates PHP values against constraints. Methods ------- | | | | | --- | --- | --- | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | [getMetadataFor](#method_getMetadataFor)(mixed $value) Returns the metadata for the given value. | from [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface#method_getMetadataFor "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | | bool | [hasMetadataFor](#method_hasMetadataFor)(mixed $value) Returns whether the class is able to return metadata for the given value. | from [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface#method_hasMetadataFor "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validateProperty](#method_validateProperty)(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validatePropertyValue](#method_validatePropertyValue)(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. | | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | [startContext](#method_startContext)() Starts a new validation context and returns a validator for that context. | | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | [inContext](#method_inContext)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Returns a validator in the given execution context. | | Details ------- ### [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") getMetadataFor(mixed $value) Returns the metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | The metadata for the value | #### Exceptions | | | | --- | --- | | [NoSuchMetadataException](../exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | If no metadata exists for the given value | ### bool hasMetadataFor(mixed $value) Returns whether the class is able to return metadata for the given value. #### Parameters | | | | | --- | --- | --- | | mixed | $value | Some value | #### Return Value | | | | --- | --- | | bool | Whether metadata can be returned for that value | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to validate | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | The constraint(s) to validate against | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validateProperty(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. #### Parameters | | | | | --- | --- | --- | | object | $object | The object | | string | $propertyName | The name of the validated property | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClass | The object or its class name | | string | $propertyName | The name of the property | | mixed | $value | The value to validate against the property's constraints | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") startContext() Starts a new validation context and returns a validator for that context. The returned validator collects all violations generated within its context. You can access these violations with the {@link ContextualValidatorInterface::getViolations()} method. #### Return Value | | | | --- | --- | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | The validator for the new context | ### [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") inContext([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Returns a validator in the given execution context. The returned validator adds all generated violations to the given context. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | #### Return Value | | | | --- | --- | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | The validator for that context | symfony ContextualValidatorInterface ContextualValidatorInterface ============================= interface **ContextualValidatorInterface** A validator in a specific execution context. Methods ------- | | | | | --- | --- | --- | | $this | [atPath](#method_atPath)(string $path) Appends the given path to the property path of the context. | | | $this | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. | | | $this | [validateProperty](#method_validateProperty)(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. | | | $this | [validatePropertyValue](#method_validatePropertyValue)(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [getViolations](#method_getViolations)() Returns the violations that have been generated so far in the context of the validator. | | Details ------- ### $this atPath(string $path) Appends the given path to the property path of the context. If called multiple times, the path will always be reset to the context's original path with the given path appended to it. #### Parameters | | | | | --- | --- | --- | | string | $path | The path to append | #### Return Value | | | | --- | --- | | $this | | ### $this validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to validate | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | The constraint(s) to validate against | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | $this | | ### $this validateProperty(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. #### Parameters | | | | | --- | --- | --- | | object | $object | The object | | string | $propertyName | The name of the validated property | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | $this | | ### $this validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClass | The object or its class name | | string | $propertyName | The name of the property | | mixed | $value | The value to validate against the property's constraints | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | $this | | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") getViolations() Returns the violations that have been generated so far in the context of the validator. #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | The constraint violations |
programming_docs
symfony RecursiveValidator RecursiveValidator =================== class **RecursiveValidator** implements [ValidatorInterface](validatorinterface "Symfony\Component\Validator\Validator\ValidatorInterface") Recursive implementation of {@link ValidatorInterface}. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $contextFactory | | | | protected | $metadataFactory | | | | protected | $validatorFactory | | | | protected | $objectInitializers | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ExecutionContextFactoryInterface](../context/executioncontextfactoryinterface "Symfony\Component\Validator\Context\ExecutionContextFactoryInterface") $contextFactory, [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory, [ConstraintValidatorFactoryInterface](../constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory, array $objectInitializers = array()) Creates a new validator. | | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | [startContext](#method_startContext)($root = null) Starts a new validation context and returns a validator for that context. | | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | [inContext](#method_inContext)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Returns a validator in the given execution context. | | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | [getMetadataFor](#method_getMetadataFor)($object) Returns the metadata for the given value. | | | bool | [hasMetadataFor](#method_hasMetadataFor)($object) Returns whether the class is able to return metadata for the given value. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validateProperty](#method_validateProperty)(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. | | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | [validatePropertyValue](#method_validatePropertyValue)(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. | | Details ------- ### \_\_construct([ExecutionContextFactoryInterface](../context/executioncontextfactoryinterface "Symfony\Component\Validator\Context\ExecutionContextFactoryInterface") $contextFactory, [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") $metadataFactory, [ConstraintValidatorFactoryInterface](../constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") $validatorFactory, array $objectInitializers = array()) Creates a new validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextFactoryInterface](../context/executioncontextfactoryinterface "Symfony\Component\Validator\Context\ExecutionContextFactoryInterface") | $contextFactory | The factory for creating new contexts | | [MetadataFactoryInterface](../mapping/factory/metadatafactoryinterface "Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface") | $metadataFactory | The factory for fetching the metadata of validated objects | | [ConstraintValidatorFactoryInterface](../constraintvalidatorfactoryinterface "Symfony\Component\Validator\ConstraintValidatorFactoryInterface") | $validatorFactory | The factory for creating constraint validators | | array | $objectInitializers | The object initializers | ### [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") startContext($root = null) Starts a new validation context and returns a validator for that context. The returned validator collects all violations generated within its context. You can access these violations with the {@link ContextualValidatorInterface::getViolations()} method. #### Parameters | | | | | --- | --- | --- | | | $root | | #### Return Value | | | | --- | --- | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | The validator for the new context | ### [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") inContext([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Returns a validator in the given execution context. The returned validator adds all generated violations to the given context. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | #### Return Value | | | | --- | --- | | [ContextualValidatorInterface](contextualvalidatorinterface "Symfony\Component\Validator\Validator\ContextualValidatorInterface") | The validator for that context | ### [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") getMetadataFor($object) Returns the metadata for the given value. #### Parameters | | | | | --- | --- | --- | | | $object | | #### Return Value | | | | --- | --- | | [MetadataInterface](../mapping/metadatainterface "Symfony\Component\Validator\Mapping\MetadataInterface") | The metadata for the value | #### Exceptions | | | | --- | --- | | [NoSuchMetadataException](../exception/nosuchmetadataexception "Symfony\Component\Validator\Exception\NoSuchMetadataException") | If no metadata exists for the given value | ### bool hasMetadataFor($object) Returns whether the class is able to return metadata for the given value. #### Parameters | | | | | --- | --- | --- | | | $object | | #### Return Value | | | | --- | --- | | bool | Whether metadata can be returned for that value | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] $constraints = null, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against a constraint or a list of constraints. If no constraint is passed, the constraint {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to validate | | [Constraint](../constraint "Symfony\Component\Validator\Constraint")|[Constraint](../constraint "Symfony\Component\Validator\Constraint")[] | $constraints | The constraint(s) to validate against | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validateProperty(object $object, string $propertyName, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a property of an object against the constraints specified for this property. #### Parameters | | | | | --- | --- | --- | | object | $object | The object | | string | $propertyName | The name of the validated property | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | ### [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") validatePropertyValue(object|string $objectOrClass, string $propertyName, mixed $value, string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null $groups = null) Validates a value against the constraints specified for an object's property. #### Parameters | | | | | --- | --- | --- | | object|string | $objectOrClass | The object or its class name | | string | $propertyName | The name of the property | | mixed | $value | The value to validate against the property's constraints | | string|[GroupSequence](../constraints/groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")|(string|GroupSequence)[]|null | $groups | The validation groups to validate. If none is given, "Default" is assumed | #### Return Value | | | | --- | --- | | [ConstraintViolationListInterface](../constraintviolationlistinterface "Symfony\Component\Validator\ConstraintViolationListInterface") | A list of constraint violations If the list is empty, validation succeeded | symfony ConstraintViolationAssertion ConstraintViolationAssertion ============================= class **ConstraintViolationAssertion** Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context, $message, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint = null, array $assertions = array()) | | | | [atPath](#method_atPath)($path) | | | | [setParameter](#method_setParameter)($key, $value) | | | | [setParameters](#method_setParameters)(array $parameters) | | | | [setTranslationDomain](#method_setTranslationDomain)($translationDomain) | | | | [setInvalidValue](#method_setInvalidValue)($invalidValue) | | | | [setPlural](#method_setPlural)($number) | | | | [setCode](#method_setCode)($code) | | | | [setCause](#method_setCause)($cause) | | | | [buildNextViolation](#method_buildNextViolation)($message) | | | | [assertRaised](#method_assertRaised)() | | Details ------- ### \_\_construct([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context, $message, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint = null, array $assertions = array()) #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | | | $message | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | | array | $assertions | | ### atPath($path) #### Parameters | | | | | --- | --- | --- | | | $path | | ### setParameter($key, $value) #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | ### setParameters(array $parameters) #### Parameters | | | | | --- | --- | --- | | array | $parameters | | ### setTranslationDomain($translationDomain) #### Parameters | | | | | --- | --- | --- | | | $translationDomain | | ### setInvalidValue($invalidValue) #### Parameters | | | | | --- | --- | --- | | | $invalidValue | | ### setPlural($number) #### Parameters | | | | | --- | --- | --- | | | $number | | ### setCode($code) #### Parameters | | | | | --- | --- | --- | | | $code | | ### setCause($cause) #### Parameters | | | | | --- | --- | --- | | | $cause | | ### buildNextViolation($message) #### Parameters | | | | | --- | --- | --- | | | $message | | ### assertRaised() symfony ConstraintValidatorTestCase ConstraintValidatorTestCase ============================ abstract class **ConstraintValidatorTestCase** extends TestCase A test case to ease testing Constraint Validators. Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | | | protected [ConstraintValidatorInterface](../constraintvalidatorinterface "Symfony\Component\Validator\ConstraintValidatorInterface") | $validator | | | | protected | $group | | | | protected | $metadata | | | | protected | $object | | | | protected | $value | | | | protected | $root | | | | protected | $propertyPath | | | | protected | $constraint | | | | protected | $defaultTimezone | | | Methods ------- | | | | | --- | --- | --- | | | [setUp](#method_setUp)() | | | | [tearDown](#method_tearDown)() | | | | [setDefaultTimezone](#method_setDefaultTimezone)($defaultTimezone) | | | | [restoreDefaultTimezone](#method_restoreDefaultTimezone)() | | | | [createContext](#method_createContext)() | | | | [setGroup](#method_setGroup)($group) | | | | [setObject](#method_setObject)($object) | | | | [setProperty](#method_setProperty)($object, $property) | | | | [setValue](#method_setValue)($value) | | | | [setRoot](#method_setRoot)($root) | | | | [setPropertyPath](#method_setPropertyPath)($propertyPath) | | | | [expectNoValidate](#method_expectNoValidate)() | | | | [expectValidateAt](#method_expectValidateAt)($i, $propertyPath, $value, $group) | | | | [expectValidateValueAt](#method_expectValidateValueAt)($i, $propertyPath, $value, $constraints, $group = null) | | | | [assertNoViolation](#method_assertNoViolation)() | | | [ConstraintViolationAssertion](constraintviolationassertion "Symfony\Component\Validator\Test\ConstraintViolationAssertion") | [buildViolation](#method_buildViolation)($message) | | | | [createValidator](#method_createValidator)() | | Details ------- ### protected setUp() ### protected tearDown() ### protected setDefaultTimezone($defaultTimezone) #### Parameters | | | | | --- | --- | --- | | | $defaultTimezone | | ### protected restoreDefaultTimezone() ### protected createContext() ### protected setGroup($group) #### Parameters | | | | | --- | --- | --- | | | $group | | ### protected setObject($object) #### Parameters | | | | | --- | --- | --- | | | $object | | ### protected setProperty($object, $property) #### Parameters | | | | | --- | --- | --- | | | $object | | | | $property | | ### protected setValue($value) #### Parameters | | | | | --- | --- | --- | | | $value | | ### protected setRoot($root) #### Parameters | | | | | --- | --- | --- | | | $root | | ### protected setPropertyPath($propertyPath) #### Parameters | | | | | --- | --- | --- | | | $propertyPath | | ### protected expectNoValidate() ### protected expectValidateAt($i, $propertyPath, $value, $group) #### Parameters | | | | | --- | --- | --- | | | $i | | | | $propertyPath | | | | $value | | | | $group | | ### protected expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null) #### Parameters | | | | | --- | --- | --- | | | $i | | | | $propertyPath | | | | $value | | | | $constraints | | | | $group | | ### protected assertNoViolation() ### protected [ConstraintViolationAssertion](constraintviolationassertion "Symfony\Component\Validator\Test\ConstraintViolationAssertion") buildViolation($message) #### Parameters | | | | | --- | --- | --- | | | $message | | #### Return Value | | | | --- | --- | | [ConstraintViolationAssertion](constraintviolationassertion "Symfony\Component\Validator\Test\ConstraintViolationAssertion") | | ### abstract protected createValidator() symfony IbanValidator IbanValidator ============== class **IbanValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony CallbackValidator CallbackValidator ================== class **CallbackValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validator for Callback constraint. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)($object, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate($object, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | | $object | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony All All ==== class **All** extends [Composite](composite "Symfony\Component\Validator\Constraints\Composite") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $constraints | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Composite](composite#method___construct "Symfony\Component\Validator\Constraints\Composite") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Composite](composite#method_addImplicitGroupName "Symfony\Component\Validator\Constraints\Composite") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string | [getCompositeOption](#method_getCompositeOption)() Returns the name of the property that contains the nested constraints. | | | | [initializeNestedConstraints](#method_initializeNestedConstraints)() Initializes the nested constraints. | from [Composite](composite#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Composite") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### protected string getCompositeOption() Returns the name of the property that contains the nested constraints. #### Return Value | | | | --- | --- | | string | The property name | ### protected initializeNestedConstraints() Initializes the nested constraints. This method can be overwritten in subclasses to clean up the nested constraints passed to the constructor. #### See also | | | | --- | --- | | [Collection::initializeNestedConstraints](collection#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Collection") | | symfony NotNullValidator NotNullValidator ================= class **NotNullValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Iban Iban ===== class **Iban** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_COUNTRY\_CODE\_ERROR | | | INVALID\_CHARACTERS\_ERROR | | | CHECKSUM\_FAILED\_ERROR | | | INVALID\_FORMAT\_ERROR | | | NOT\_SUPPORTED\_COUNTRY\_CODE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony Country Country ======== class **Country** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NO\_SUCH\_COUNTRY\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony LessThan LessThan ========= class **LessThan** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_HIGH\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony NotBlank NotBlank ========= class **NotBlank** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | IS\_BLANK\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony Regex Regex ====== class **Regex** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | REGEX\_FAILED\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $pattern | | | | | $htmlPattern | | | | | $match | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string|null | [getHtmlPattern](#method_getHtmlPattern)() Converts the htmlPattern to a suitable format for HTML5 pattern. | | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### string|null getHtmlPattern() Converts the htmlPattern to a suitable format for HTML5 pattern. Example: /^[a-z]+$/ would be converted to [a-z]+ However, if options are specified, it cannot be converted. Pattern is also ignored if match=false since the pattern should then be reversed before application. #### Return Value | | | | --- | --- | | string|null | | #### See also | | | | --- | --- | | <http://dev.w3.org/html5/spec/single-page.html#the-pattern-attribute> | | symfony ImageValidator ImageValidator =============== class **ImageValidator** extends [FileValidator](filevalidator "Symfony\Component\Validator\Constraints\FileValidator") Validates whether a value is a valid image file and is valid against minWidth, maxWidth, minHeight and maxHeight constraints. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | KB\_BYTES | | | MB\_BYTES | | | KIB\_BYTES | | | MIB\_BYTES | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony NotEqualTo NotEqualTo =========== class **NotEqualTo** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | IS\_EQUAL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony Image Image ====== class **Image** extends [File](file "Symfony\Component\Validator\Constraints\File") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_FOUND\_ERROR | | | NOT\_READABLE\_ERROR | | | EMPTY\_ERROR | | | TOO\_LARGE\_ERROR | | | INVALID\_MIME\_TYPE\_ERROR | | | SIZE\_NOT\_DETECTED\_ERROR | | | TOO\_WIDE\_ERROR | | | TOO\_NARROW\_ERROR | | | TOO\_HIGH\_ERROR | | | TOO\_LOW\_ERROR | | | TOO\_FEW\_PIXEL\_ERROR | | | TOO\_MANY\_PIXEL\_ERROR | | | RATIO\_TOO\_BIG\_ERROR | | | RATIO\_TOO\_SMALL\_ERROR | | | SQUARE\_NOT\_ALLOWED\_ERROR | | | LANDSCAPE\_NOT\_ALLOWED\_ERROR | | | PORTRAIT\_NOT\_ALLOWED\_ERROR | | | CORRUPTED\_IMAGE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $binaryFormat | | from [File](file#property_binaryFormat "Symfony\Component\Validator\Constraints\File") | | | $mimeTypes | | | | | $notFoundMessage | | from [File](file#property_notFoundMessage "Symfony\Component\Validator\Constraints\File") | | | $notReadableMessage | | from [File](file#property_notReadableMessage "Symfony\Component\Validator\Constraints\File") | | | $maxSizeMessage | | from [File](file#property_maxSizeMessage "Symfony\Component\Validator\Constraints\File") | | | $mimeTypesMessage | | | | | $disallowEmptyMessage | | from [File](file#property_disallowEmptyMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadIniSizeErrorMessage | | from [File](file#property_uploadIniSizeErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadFormSizeErrorMessage | | from [File](file#property_uploadFormSizeErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadPartialErrorMessage | | from [File](file#property_uploadPartialErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadNoFileErrorMessage | | from [File](file#property_uploadNoFileErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadNoTmpDirErrorMessage | | from [File](file#property_uploadNoTmpDirErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadCantWriteErrorMessage | | from [File](file#property_uploadCantWriteErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadExtensionErrorMessage | | from [File](file#property_uploadExtensionErrorMessage "Symfony\Component\Validator\Constraints\File") | | | $uploadErrorMessage | | from [File](file#property_uploadErrorMessage "Symfony\Component\Validator\Constraints\File") | | int | $maxSize | | from [File](file#property_maxSize "Symfony\Component\Validator\Constraints\File") | | | $minWidth | | | | | $maxWidth | | | | | $maxHeight | | | | | $minHeight | | | | | $maxRatio | | | | | $minRatio | | | | | $minPixels | | | | | $maxPixels | | | | | $allowSquare | | | | | $allowLandscape | | | | | $allowPortrait | | | | | $detectCorrupted | | | | | $sizeNotDetectedMessage | | | | | $maxWidthMessage | | | | | $minWidthMessage | | | | | $maxHeightMessage | | | | | $minHeightMessage | | | | | $minPixelsMessage | | | | | $maxPixelsMessage | | | | | $maxRatioMessage | | | | | $minRatioMessage | | | | | $allowSquareMessage | | | | | $allowLandscapeMessage | | | | | $allowPortraitMessage | | | | | $corruptedMessage | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [File](file#method___construct "Symfony\Component\Validator\Constraints\File") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [File](file#method___set "Symfony\Component\Validator\Constraints\File") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [File](file#method___get "Symfony\Component\Validator\Constraints\File") | | bool | [\_\_isset](#method___isset)(string $option) | from [File](file#method___isset "Symfony\Component\Validator\Constraints\File") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Ip Ip === class **Ip** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Validates that a value is a valid IP address. Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | V4 | | | V6 | | | ALL | | | V4\_NO\_PRIV | | | V6\_NO\_PRIV | | | ALL\_NO\_PRIV | | | V4\_NO\_RES | | | V6\_NO\_RES | | | ALL\_NO\_RES | | | V4\_ONLY\_PUBLIC | | | V6\_ONLY\_PUBLIC | | | ALL\_ONLY\_PUBLIC | | | INVALID\_IP\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | static protected | $versions | | | | | $version | | | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony LessThanValidator LessThanValidator ================== class **LessThanValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are less than the previous (<). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set |
programming_docs
symfony Bic Bic ==== class **Bic** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_LENGTH\_ERROR | | | INVALID\_CHARACTERS\_ERROR | | | INVALID\_BANK\_CODE\_ERROR | | | INVALID\_COUNTRY\_CODE\_ERROR | | | INVALID\_CASE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony LocaleValidator LocaleValidator ================ class **LocaleValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether a value is a valid locale code. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Type Type ===== class **Type** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_TYPE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $type | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony BicValidator BicValidator ============= class **BicValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Optional Optional ========= class **Optional** extends [Existence](existence "Symfony\Component\Validator\Constraints\Existence") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $constraints | | from [Existence](existence#property_constraints "Symfony\Component\Validator\Constraints\Existence") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Composite](composite#method___construct "Symfony\Component\Validator\Constraints\Composite") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Composite](composite#method_addImplicitGroupName "Symfony\Component\Validator\Constraints\Composite") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Existence](existence#method_getDefaultOption "Symfony\Component\Validator\Constraints\Existence") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string | [getCompositeOption](#method_getCompositeOption)() Returns the name of the property that contains the nested constraints. | from [Existence](existence#method_getCompositeOption "Symfony\Component\Validator\Constraints\Existence") | | | [initializeNestedConstraints](#method_initializeNestedConstraints)() Initializes the nested constraints. | from [Composite](composite#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Composite") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### protected string getCompositeOption() Returns the name of the property that contains the nested constraints. #### Return Value | | | | --- | --- | | string | The property name | ### protected initializeNestedConstraints() Initializes the nested constraints. This method can be overwritten in subclasses to clean up the nested constraints passed to the constructor. #### See also | | | | --- | --- | | [Collection::initializeNestedConstraints](collection#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Collection") | | symfony CardSchemeValidator CardSchemeValidator ==================== class **CardSchemeValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates that a card number belongs to a specified scheme. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | | protected | $schemes | | | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Validates a creditcard belongs to a specified scheme. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Validates a creditcard belongs to a specified scheme. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony IsTrueValidator IsTrueValidator ================ class **IsTrueValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony GreaterThanValidator GreaterThanValidator ===================== class **GreaterThanValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are greater than the previous (>). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set | symfony Required Required ========= class **Required** extends [Existence](existence "Symfony\Component\Validator\Constraints\Existence") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $constraints | | from [Existence](existence#property_constraints "Symfony\Component\Validator\Constraints\Existence") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Composite](composite#method___construct "Symfony\Component\Validator\Constraints\Composite") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Composite](composite#method_addImplicitGroupName "Symfony\Component\Validator\Constraints\Composite") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Existence](existence#method_getDefaultOption "Symfony\Component\Validator\Constraints\Existence") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string | [getCompositeOption](#method_getCompositeOption)() Returns the name of the property that contains the nested constraints. | from [Existence](existence#method_getCompositeOption "Symfony\Component\Validator\Constraints\Existence") | | | [initializeNestedConstraints](#method_initializeNestedConstraints)() Initializes the nested constraints. | from [Composite](composite#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Composite") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### protected string getCompositeOption() Returns the name of the property that contains the nested constraints. #### Return Value | | | | --- | --- | | string | The property name | ### protected initializeNestedConstraints() Initializes the nested constraints. This method can be overwritten in subclasses to clean up the nested constraints passed to the constructor. #### See also | | | | --- | --- | | [Collection::initializeNestedConstraints](collection#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Collection") | | symfony Uuid Uuid ===== class **Uuid** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_SHORT\_ERROR | | | TOO\_LONG\_ERROR | | | INVALID\_CHARACTERS\_ERROR | | | INVALID\_HYPHEN\_PLACEMENT\_ERROR | | | INVALID\_VERSION\_ERROR | | | INVALID\_VARIANT\_ERROR | | | V1\_MAC | | | V2\_DCE | | | V3\_MD5 | | | V4\_RANDOM | | | V5\_SHA1 | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | string | $message | Message to display when validation fails. | | | bool | $strict | Strict mode only allows UUIDs that meet the formal definition and formatting per RFC 4122. | | | int[] | $versions | Array of allowed versions (see version constants above). | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony NotIdenticalTo NotIdenticalTo =============== class **NotIdenticalTo** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | IS\_IDENTICAL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Collection Collection =========== class **Collection** extends [Composite](composite "Symfony\Component\Validator\Constraints\Composite") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | MISSING\_FIELD\_ERROR | | | NO\_SUCH\_FIELD\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $fields | | | | | $allowExtraFields | | | | | $allowMissingFields | | | | | $extraFieldsMessage | | | | | $missingFieldsMessage | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Composite](composite#method_addImplicitGroupName "Symfony\Component\Validator\Constraints\Composite") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string | [getCompositeOption](#method_getCompositeOption)() Returns the name of the property that contains the nested constraints. | | | | [initializeNestedConstraints](#method_initializeNestedConstraints)() Initializes the nested constraints. | | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### protected string getCompositeOption() Returns the name of the property that contains the nested constraints. #### Return Value | | | | --- | --- | | string | The property name | ### protected initializeNestedConstraints() Initializes the nested constraints. This method can be overwritten in subclasses to clean up the nested constraints passed to the constructor. symfony Email Email ====== class **Email** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | VALIDATION\_MODE\_HTML5 | | | VALIDATION\_MODE\_STRICT | | | VALIDATION\_MODE\_LOOSE | | | INVALID\_FORMAT\_ERROR | | | MX\_CHECK\_FAILED\_ERROR | | | HOST\_CHECK\_FAILED\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | static string[] | $validationModes | | | | | $message | | | | | $checkMX | | | | | $checkHost | | | | | $strict | | | | | $mode | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony AbstractComparison AbstractComparison =================== abstract class **AbstractComparison** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Used for the comparison of values. Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | | | | $propertyPath | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony DateValidator DateValidator ============== class **DateValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | PATTERN | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | static bool | [checkDate](#method_checkDate)(int $year, int $month, int $day) Checks whether a date is valid. | | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### static bool checkDate(int $year, int $month, int $day) Checks whether a date is valid. #### Parameters | | | | | --- | --- | --- | | int | $year | The year | | int | $month | The month | | int | $day | The day | #### Return Value | | | | --- | --- | | bool | Whether the date is valid | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony CollectionValidator CollectionValidator ==================== class **CollectionValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony IssnValidator IssnValidator ============== class **IssnValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether the value is a valid ISSN. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony IsTrue IsTrue ======= class **IsTrue** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_TRUE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony IpValidator IpValidator ============ class **IpValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether a value is a valid IP address. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony LessThanOrEqual LessThanOrEqual ================ class **LessThanOrEqual** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_HIGH\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony CountValidator CountValidator =============== class **CountValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony CurrencyValidator CurrencyValidator ================== class **CurrencyValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether a value is a valid currency. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony FileValidator FileValidator ============== class **FileValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | KB\_BYTES | | | MB\_BYTES | | | KIB\_BYTES | | | MIB\_BYTES | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Choice Choice ======= class **Choice** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NO\_SUCH\_CHOICE\_ERROR | | | TOO\_FEW\_ERROR | | | TOO\_MANY\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $choices | | | | | $callback | | | | | $multiple | | | | | $strict | | | | | $min | | | | | $max | | | | | $message | | | | | $multipleMessage | | | | | $minMessage | | | | | $maxMessage | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony RegexValidator RegexValidator =============== class **RegexValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether a value match or not given regexp pattern. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Count Count ====== class **Count** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_FEW\_ERROR | | | TOO\_MANY\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $minMessage | | | | | $maxMessage | | | | | $exactMessage | | | | | $min | | | | | $max | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Length Length ======= class **Length** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_SHORT\_ERROR | | | TOO\_LONG\_ERROR | | | INVALID\_CHARACTERS\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $maxMessage | | | | | $minMessage | | | | | $exactMessage | | | | | $charsetMessage | | | | | $max | | | | | $min | | | | | $charset | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony Url Url ==== class **Url** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | CHECK\_DNS\_TYPE\_ANY | | | CHECK\_DNS\_TYPE\_NONE | | | CHECK\_DNS\_TYPE\_A | | | CHECK\_DNS\_TYPE\_A6 | | | CHECK\_DNS\_TYPE\_AAAA | | | CHECK\_DNS\_TYPE\_CNAME | | | CHECK\_DNS\_TYPE\_MX | | | CHECK\_DNS\_TYPE\_NAPTR | | | CHECK\_DNS\_TYPE\_NS | | | CHECK\_DNS\_TYPE\_PTR | | | CHECK\_DNS\_TYPE\_SOA | | | CHECK\_DNS\_TYPE\_SRV | | | CHECK\_DNS\_TYPE\_TXT | | | INVALID\_URL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $dnsMessage | | | | | $protocols | | | | | $checkDNS | | | | | $relativeProtocol | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Issn Issn ===== class **Issn** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_SHORT\_ERROR | | | TOO\_LONG\_ERROR | | | MISSING\_HYPHEN\_ERROR | | | INVALID\_CHARACTERS\_ERROR | | | INVALID\_CASE\_ERROR | | | CHECKSUM\_FAILED\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $caseSensitive | | | | | $requireHyphen | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony DateTimeValidator DateTimeValidator ================== class **DateTimeValidator** extends [DateValidator](datevalidator "Symfony\Component\Validator\Constraints\DateValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | PATTERN | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | static bool | [checkDate](#method_checkDate)(int $year, int $month, int $day) Checks whether a date is valid. | from [DateValidator](datevalidator#method_checkDate "Symfony\Component\Validator\Constraints\DateValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### static bool checkDate(int $year, int $month, int $day) Checks whether a date is valid. #### Parameters | | | | | --- | --- | --- | | int | $year | The year | | int | $month | The month | | int | $day | The day | #### Return Value | | | | --- | --- | | bool | Whether the date is valid | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony ChoiceValidator ChoiceValidator ================ class **ChoiceValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") ChoiceValidator validates that the value is one of the expected values. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Time Time ===== class **Time** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_FORMAT\_ERROR | | | INVALID\_TIME\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony UuidValidator UuidValidator ============== class **UuidValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether the value is a valid UUID (also known as GUID). Strict validation will allow a UUID as specified per RFC 4122. Loose validation will allow any type of UUID. For better compatibility, both loose and strict, you should consider using a specialized UUID library like "ramsey/uuid" instead. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | STRICT\_LENGTH | | | STRICT\_FIRST\_HYPHEN\_POSITION | | | STRICT\_LAST\_HYPHEN\_POSITION | | | STRICT\_VERSION\_POSITION | | | STRICT\_VARIANT\_POSITION | | | LOOSE\_MAX\_LENGTH | | | LOOSE\_FIRST\_HYPHEN\_POSITION | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Blank Blank ====== class **Blank** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_BLANK\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony AbstractComparisonValidator AbstractComparisonValidator ============================ abstract class **AbstractComparisonValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Provides a base class for the validation of property comparisons. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### abstract protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set | symfony AllValidator AllValidator ============= class **AllValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Expression Expression =========== class **Expression** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | EXPRESSION\_FAILED\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $expression | | | | | $values | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony LanguageValidator LanguageValidator ================== class **LanguageValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether a value is a valid language code. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony LuhnValidator LuhnValidator ============== class **LuhnValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates a PAN using the LUHN Algorithm. For a list of example card numbers that are used to test this class, please see the LuhnValidatorTest class. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Validates a credit card number with the Luhn algorithm. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Validates a credit card number with the Luhn algorithm. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | #### Exceptions | | | | --- | --- | | [UnexpectedTypeException](../exception/unexpectedtypeexception "Symfony\Component\Validator\Exception\UnexpectedTypeException") | when the given credit card number is no string | symfony Valid Valid ====== class **Valid** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $traverse | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony EqualTo EqualTo ======== class **EqualTo** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_EQUAL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony NotEqualToValidator NotEqualToValidator ==================== class **NotEqualToValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are all unequal (!=). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set | symfony Locale Locale ======= class **Locale** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NO\_SUCH\_LOCALE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $canonicalize | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Callback Callback ========= class **Callback** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | string|callable | $callback | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony Composite Composite ========== abstract class **Composite** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") A constraint that is composed of other constraints. You should never use the nested constraint instances anywhere else, because their groups are adapted when passed to the constructor of this class. If you want to create your own composite constraint, extend this class and let {@link getCompositeOption()} return the name of the property which contains the nested constraints. Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string | [getCompositeOption](#method_getCompositeOption)() Returns the name of the property that contains the nested constraints. | | | | [initializeNestedConstraints](#method_initializeNestedConstraints)() Initializes the nested constraints. | | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### abstract protected string getCompositeOption() Returns the name of the property that contains the nested constraints. #### Return Value | | | | --- | --- | | string | The property name | ### protected initializeNestedConstraints() Initializes the nested constraints. This method can be overwritten in subclasses to clean up the nested constraints passed to the constructor. #### See also | | | | --- | --- | | [Collection::initializeNestedConstraints](collection#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Collection") | | symfony UrlValidator UrlValidator ============= class **UrlValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | PATTERN | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony IsNull IsNull ======= class **IsNull** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_NULL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony IdenticalTo IdenticalTo ============ class **IdenticalTo** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_IDENTICAL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony EmailValidator EmailValidator =============== class **EmailValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | PATTERN\_HTML5 | | | PATTERN\_LOOSE | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)(string $defaultMode = Email::VALIDATION\_MODE\_LOOSE) | | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct(string $defaultMode = Email::VALIDATION\_MODE\_LOOSE) #### Parameters | | | | | --- | --- | --- | | string | $defaultMode | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony File File ===== class **File** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_FOUND\_ERROR | | | NOT\_READABLE\_ERROR | | | EMPTY\_ERROR | | | TOO\_LARGE\_ERROR | | | INVALID\_MIME\_TYPE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $binaryFormat | | | | | $mimeTypes | | | | | $notFoundMessage | | | | | $notReadableMessage | | | | | $maxSizeMessage | | | | | $mimeTypesMessage | | | | | $disallowEmptyMessage | | | | | $uploadIniSizeErrorMessage | | | | | $uploadFormSizeErrorMessage | | | | | $uploadPartialErrorMessage | | | | | $uploadNoFileErrorMessage | | | | | $uploadNoTmpDirErrorMessage | | | | | $uploadCantWriteErrorMessage | | | | | $uploadExtensionErrorMessage | | | | | $uploadErrorMessage | | | | int | $maxSize | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | | | bool | [\_\_isset](#method___isset)(string $option) | | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony NotBlankValidator NotBlankValidator ================== class **NotBlankValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony BlankValidator BlankValidator =============== class **BlankValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony CardScheme CardScheme =========== class **CardScheme** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Metadata for the CardSchemeValidator. Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_NUMERIC\_ERROR | | | INVALID\_FORMAT\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $schemes | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony CountryValidator CountryValidator ================= class **CountryValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether a value is a valid country code. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony Currency Currency ========= class **Currency** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NO\_SUCH\_CURRENCY\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony GreaterThanOrEqualValidator GreaterThanOrEqualValidator ============================ class **GreaterThanOrEqualValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are greater than or equal to the previous (>=). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set | symfony GroupSequenceProvider GroupSequenceProvider ====================== class **GroupSequenceProvider** Annotation to define a group sequence provider. symfony LengthValidator LengthValidator ================ class **LengthValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony Range Range ====== class **Range** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_CHARACTERS\_ERROR | | | TOO\_HIGH\_ERROR | | | TOO\_LOW\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $minMessage | | | | | $maxMessage | | | | | $invalidMessage | | | | | $min | | | | | $max | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony IsNullValidator IsNullValidator ================ class **IsNullValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Isbn Isbn ===== class **Isbn** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_SHORT\_ERROR | | | TOO\_LONG\_ERROR | | | INVALID\_CHARACTERS\_ERROR | | | CHECKSUM\_FAILED\_ERROR | | | TYPE\_NOT\_RECOGNIZED\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $isbn10Message | | | | | $isbn13Message | | | | | $bothIsbnMessage | | | | | $type | | | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony TimeValidator TimeValidator ============== class **TimeValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | | PATTERN | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | static bool | [checkTime](#method_checkTime)(int $hour, int $minute, int $second) Checks whether a time is valid. | | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### static bool checkTime(int $hour, int $minute, int $second) Checks whether a time is valid. #### Parameters | | | | | --- | --- | --- | | int | $hour | The hour | | int | $minute | The minute | | int | $second | The second | #### Return Value | | | | --- | --- | | bool | Whether the time is valid | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony IsFalseValidator IsFalseValidator ================= class **IsFalseValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony Existence Existence ========== abstract class **Existence** extends [Composite](composite "Symfony\Component\Validator\Constraints\Composite") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $constraints | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Composite](composite#method___construct "Symfony\Component\Validator\Constraints\Composite") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Composite](composite#method_addImplicitGroupName "Symfony\Component\Validator\Constraints\Composite") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | | string | [getCompositeOption](#method_getCompositeOption)() Returns the name of the property that contains the nested constraints. | | | | [initializeNestedConstraints](#method_initializeNestedConstraints)() Initializes the nested constraints. | from [Composite](composite#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Composite") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | ### protected string getCompositeOption() Returns the name of the property that contains the nested constraints. #### Return Value | | | | --- | --- | | string | The property name | ### protected initializeNestedConstraints() Initializes the nested constraints. This method can be overwritten in subclasses to clean up the nested constraints passed to the constructor. #### See also | | | | --- | --- | | [Collection::initializeNestedConstraints](collection#method_initializeNestedConstraints "Symfony\Component\Validator\Constraints\Collection") | | symfony EqualToValidator EqualToValidator ================= class **EqualToValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are equal (==). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set |
programming_docs
symfony Luhn Luhn ===== class **Luhn** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Metadata for the LuhnValidator. Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_CHARACTERS\_ERROR | | | CHECKSUM\_FAILED\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony GroupSequence GroupSequence ============== class **GroupSequence** A sequence of validation groups. When validating a group sequence, each group will only be validated if all of the previous groups in the sequence succeeded. For example: ``` $validator->validate($address, null, new GroupSequence(array('Basic', 'Strict'))); ``` In the first step, all constraints that belong to the group "Basic" will be validated. If none of the constraints fail, the validator will then validate the constraints in group "Strict". This is useful, for example, if "Strict" contains expensive checks that require a lot of CPU or slow, external services. You usually don't want to run expensive checks if any of the cheap checks fail. When adding metadata to a class, you can override the "Default" group of that class with a group sequence: ``` /** * @GroupSequence({"Address", "Strict"}) *\/ class Address { // ... } ``` Whenever you validate that object in the "Default" group, the group sequence will be validated: ``` $validator->validate($address); ``` If you want to execute the constraints of the "Default" group for a class with an overridden default group, pass the class name as group name instead: ``` $validator->validate($address, null, "Address") ``` Properties ---------- | | | | | | --- | --- | --- | --- | | string[]|array[]|[GroupSequence](groupsequence "Symfony\Component\Validator\Constraints\GroupSequence")[] | $groups | The groups in the sequence. | | | string|[GroupSequence](groupsequence "Symfony\Component\Validator\Constraints\GroupSequence") | $cascadedGroup | The group in which cascaded objects are validated when validating this sequence. | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $groups) Creates a new group sequence. | | Details ------- ### \_\_construct(array $groups) Creates a new group sequence. #### Parameters | | | | | --- | --- | --- | | array | $groups | The groups in the sequence | symfony IsFalse IsFalse ======== class **IsFalse** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NOT\_FALSE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony IsbnValidator IsbnValidator ============== class **IsbnValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Validates whether the value is a valid ISBN-10 or ISBN-13. Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | | | [validateIsbn10](#method_validateIsbn10)($isbn) | | | | [validateIsbn13](#method_validateIsbn13)($isbn) | | | | [getMessage](#method_getMessage)($constraint, $type = null) | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected validateIsbn10($isbn) #### Parameters | | | | | --- | --- | --- | | | $isbn | | ### protected validateIsbn13($isbn) #### Parameters | | | | | --- | --- | --- | | | $isbn | | ### protected getMessage($constraint, $type = null) #### Parameters | | | | | --- | --- | --- | | | $constraint | | | | $type | |
programming_docs
symfony Traverse Traverse ========= class **Traverse** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | Maps error codes to the names of their constants. | from [Constraint](../constraint#property_errorNames "Symfony\Component\Validator\Constraint") | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $traverse | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony GreaterThan GreaterThan ============ class **GreaterThan** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_LOW\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Language Language ========= class **Language** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | NO\_SUCH\_LANGUAGE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony LessThanOrEqualValidator LessThanOrEqualValidator ========================= class **LessThanOrEqualValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are less than or equal to the previous (<=). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set | symfony DateTime DateTime ========= class **DateTime** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_FORMAT\_ERROR | | | INVALID\_DATE\_ERROR | | | INVALID\_TIME\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $format | | | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony ValidValidator ValidValidator =============== class **ValidValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation |
programming_docs
symfony NotIdenticalToValidator NotIdenticalToValidator ======================== class **NotIdenticalToValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values aren't identical (!==). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set | symfony NotNull NotNull ======== class **NotNull** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | IS\_NULL\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony Date Date ===== class **Date** extends [Constraint](../constraint "Symfony\Component\Validator\Constraint") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | INVALID\_FORMAT\_ERROR | | | INVALID\_DATE\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [Constraint](../constraint#method___construct "Symfony\Component\Validator\Constraint") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [Constraint](../constraint#method_getDefaultOption "Symfony\Component\Validator\Constraint") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | #### See also | | | | --- | --- | | \_\_construct() | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize |
programming_docs
symfony ExpressionValidator ExpressionValidator ==================== class **ExpressionValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)($propertyAccessor = null, [ExpressionLanguage](../../expressionlanguage/expressionlanguage "Symfony\Component\ExpressionLanguage\ExpressionLanguage") $expressionLanguage = null) | | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct($propertyAccessor = null, [ExpressionLanguage](../../expressionlanguage/expressionlanguage "Symfony\Component\ExpressionLanguage\ExpressionLanguage") $expressionLanguage = null) #### Parameters | | | | | --- | --- | --- | | | $propertyAccessor | | | [ExpressionLanguage](../../expressionlanguage/expressionlanguage "Symfony\Component\ExpressionLanguage\ExpressionLanguage") | $expressionLanguage | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony RangeValidator RangeValidator =============== class **RangeValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony GreaterThanOrEqual GreaterThanOrEqual =================== class **GreaterThanOrEqual** extends [AbstractComparison](abstractcomparison "Symfony\Component\Validator\Constraints\AbstractComparison") Constants --------- | | | | --- | --- | | DEFAULT\_GROUP | *The name of the group given to all constraints with no explicit group.* | | CLASS\_CONSTRAINT | *Marks a constraint that can be put onto classes.* | | PROPERTY\_CONSTRAINT | *Marks a constraint that can be put onto properties.* | | TOO\_LOW\_ERROR | | Properties ---------- | | | | | | --- | --- | --- | --- | | static protected | $errorNames | | | | mixed | $payload | Domain-specific data attached to a constraint. | from [Constraint](../constraint#property_payload "Symfony\Component\Validator\Constraint") | | array | $groups | The groups that the constraint belongs to | from [Constraint](../constraint#property_groups "Symfony\Component\Validator\Constraint") | | | $message | | | | | $value | | from [AbstractComparison](abstractcomparison#property_value "Symfony\Component\Validator\Constraints\AbstractComparison") | | | $propertyPath | | from [AbstractComparison](abstractcomparison#property_propertyPath "Symfony\Component\Validator\Constraints\AbstractComparison") | Methods ------- | | | | | --- | --- | --- | | static string | [getErrorName](#method_getErrorName)(string $errorCode) Returns the name of the given error code. | from [Constraint](../constraint#method_getErrorName "Symfony\Component\Validator\Constraint") | | | [\_\_construct](#method___construct)(mixed $options = null) Initializes the constraint with options. | from [AbstractComparison](abstractcomparison#method___construct "Symfony\Component\Validator\Constraints\AbstractComparison") | | | [\_\_set](#method___set)(string $option, mixed $value) Sets the value of a lazily initialized option. | from [Constraint](../constraint#method___set "Symfony\Component\Validator\Constraint") | | mixed | [\_\_get](#method___get)(string $option) Returns the value of a lazily initialized option. | from [Constraint](../constraint#method___get "Symfony\Component\Validator\Constraint") | | bool | [\_\_isset](#method___isset)(string $option) | from [Constraint](../constraint#method___isset "Symfony\Component\Validator\Constraint") | | | [addImplicitGroupName](#method_addImplicitGroupName)(string $group) Adds the given group if this constraint is in the Default group. | from [Constraint](../constraint#method_addImplicitGroupName "Symfony\Component\Validator\Constraint") | | string | [getDefaultOption](#method_getDefaultOption)() Returns the name of the default option. | from [AbstractComparison](abstractcomparison#method_getDefaultOption "Symfony\Component\Validator\Constraints\AbstractComparison") | | array | [getRequiredOptions](#method_getRequiredOptions)() Returns the name of the required options. | from [Constraint](../constraint#method_getRequiredOptions "Symfony\Component\Validator\Constraint") | | string | [validatedBy](#method_validatedBy)() Returns the name of the class that validates this constraint. | from [Constraint](../constraint#method_validatedBy "Symfony\Component\Validator\Constraint") | | string|array | [getTargets](#method_getTargets)() Returns whether the constraint can be put onto classes, properties or both. | from [Constraint](../constraint#method_getTargets "Symfony\Component\Validator\Constraint") | | array | [\_\_sleep](#method___sleep)() Optimizes the serialized value to minimize storage space. | from [Constraint](../constraint#method___sleep "Symfony\Component\Validator\Constraint") | Details ------- ### static string getErrorName(string $errorCode) Returns the name of the given error code. #### Parameters | | | | | --- | --- | --- | | string | $errorCode | The error code | #### Return Value | | | | --- | --- | | string | The name of the error code | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") | If the error code does not exist | ### \_\_construct(mixed $options = null) Initializes the constraint with options. You should pass an associative array. The keys should be the names of existing properties in this class. The values should be the value for these properties. Alternatively you can override the method getDefaultOption() to return the name of an existing property. If no associative array is passed, this property is set instead. You can force that certain options are set by overriding getRequiredOptions() to return the names of these options. If any option is not set here, an exception is thrown. #### Parameters | | | | | --- | --- | --- | | mixed | $options | The options (as associative array) or the value for the default option (any other type) | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | When you pass the names of non-existing options | | [MissingOptionsException](../exception/missingoptionsexception "Symfony\Component\Validator\Exception\MissingOptionsException") | When you don't pass any of the options returned by getRequiredOptions() | | [ConstraintDefinitionException](../exception/constraintdefinitionexception "Symfony\Component\Validator\Exception\ConstraintDefinitionException") | When you don't pass an associative array, but getDefaultOption() returns null | ### \_\_set(string $option, mixed $value) Sets the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | | mixed | $value | The value to set | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### mixed \_\_get(string $option) Returns the value of a lazily initialized option. Corresponding properties are added to the object on first access. Hence this method will be called at most once per constraint instance and option name. #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | mixed | The value of the option | #### Exceptions | | | | --- | --- | | [InvalidOptionsException](../exception/invalidoptionsexception "Symfony\Component\Validator\Exception\InvalidOptionsException") | If an invalid option name is given | ### bool \_\_isset(string $option) #### Parameters | | | | | --- | --- | --- | | string | $option | The option name | #### Return Value | | | | --- | --- | | bool | | ### addImplicitGroupName(string $group) Adds the given group if this constraint is in the Default group. #### Parameters | | | | | --- | --- | --- | | string | $group | | ### string getDefaultOption() Returns the name of the default option. Override this method to define a default option. #### Return Value | | | | --- | --- | | string | | ### array getRequiredOptions() Returns the name of the required options. Override this method if you want to define required options. #### Return Value | | | | --- | --- | | array | | #### See also | | | | --- | --- | | \_\_construct() | | ### string validatedBy() Returns the name of the class that validates this constraint. By default, this is the fully qualified name of the constraint class suffixed with "Validator". You can override this method to change that behaviour. #### Return Value | | | | --- | --- | | string | | ### string|array getTargets() Returns whether the constraint can be put onto classes, properties or both. This method should return one or more of the constants Constraint::CLASS\_CONSTRAINT and Constraint::PROPERTY\_CONSTRAINT. #### Return Value | | | | --- | --- | | string|array | One or more constant values | ### array \_\_sleep() Optimizes the serialized value to minimize storage space. #### Return Value | | | | --- | --- | | array | The properties to serialize | symfony IdenticalToValidator IdenticalToValidator ===================== class **IdenticalToValidator** extends [AbstractComparisonValidator](abstractcomparisonvalidator "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") Validates values are identical (===). Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [\_\_construct](#method___construct)([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) | from [AbstractComparisonValidator](abstractcomparisonvalidator#method___construct "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | from [AbstractComparisonValidator](abstractcomparisonvalidator#method_validate "Symfony\Component\Validator\Constraints\AbstractComparisonValidator") | | bool | [compareValues](#method_compareValues)(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. | | | string|null | [getErrorCode](#method_getErrorCode)() Returns the error code used if the comparison fails. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### \_\_construct([PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") $propertyAccessor = null) #### Parameters | | | | | --- | --- | --- | | [PropertyAccessor](../../propertyaccess/propertyaccessor "Symfony\Component\PropertyAccess\PropertyAccessor") | $propertyAccessor | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | ### protected bool compareValues(mixed $value1, mixed $value2) Compares the two given values to find if their relationship is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value1 | The first value to compare | | mixed | $value2 | The second value to compare | #### Return Value | | | | --- | --- | | bool | true if the relationship is valid, false otherwise | ### protected string|null getErrorCode() Returns the error code used if the comparison fails. #### Return Value | | | | --- | --- | | string|null | The error code or `null` if no code should be set |
programming_docs
symfony TypeValidator TypeValidator ============== class **TypeValidator** extends [ConstraintValidator](../constraintvalidator "Symfony\Component\Validator\ConstraintValidator") Constants --------- | | | | --- | --- | | PRETTY\_DATE | *Whether to format {@link \DateTime} objects as RFC-3339 dates ("Y-m-d H:i:s").* | | OBJECT\_TO\_STRING | *Whether to cast objects with a "\_\_toString()" method to strings.* | Properties ---------- | | | | | | --- | --- | --- | --- | | protected [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | | from [ConstraintValidator](../constraintvalidator#property_context "Symfony\Component\Validator\ConstraintValidator") | Methods ------- | | | | | --- | --- | --- | | | [initialize](#method_initialize)([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. | from [ConstraintValidator](../constraintvalidator#method_initialize "Symfony\Component\Validator\ConstraintValidator") | | string | [formatTypeOf](#method_formatTypeOf)(mixed $value) Returns a string representation of the type of the value. | from [ConstraintValidator](../constraintvalidator#method_formatTypeOf "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValue](#method_formatValue)(mixed $value, int $format = 0) Returns a string representation of the value. | from [ConstraintValidator](../constraintvalidator#method_formatValue "Symfony\Component\Validator\ConstraintValidator") | | string | [formatValues](#method_formatValues)(array $values, int $format = 0) Returns a string representation of a list of values. | from [ConstraintValidator](../constraintvalidator#method_formatValues "Symfony\Component\Validator\ConstraintValidator") | | | [validate](#method_validate)(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. | | Details ------- ### initialize([ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") $context) Initializes the constraint validator. #### Parameters | | | | | --- | --- | --- | | [ExecutionContextInterface](../context/executioncontextinterface "Symfony\Component\Validator\Context\ExecutionContextInterface") | $context | The current validation context | ### protected string formatTypeOf(mixed $value) Returns a string representation of the type of the value. This method should be used if you pass the type of a value as message parameter to a constraint violation. Note that such parameters should usually not be included in messages aimed at non-technical people. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to return the type of | #### Return Value | | | | --- | --- | | string | The type of the value | ### protected string formatValue(mixed $value, int $format = 0) Returns a string representation of the value. This method returns the equivalent PHP tokens for most scalar types (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped in double quotes ("). Objects, arrays and resources are formatted as "object", "array" and "resource". If the $format bitmask contains the PRETTY\_DATE bit, then {@link \DateTime} objects will be formatted as RFC-3339 dates ("Y-m-d H:i:s"). Be careful when passing message parameters to a constraint violation that (may) contain objects, arrays or resources. These parameters should only be displayed for technical users. Non-technical users won't know what an "object", "array" or "resource" is and will be confused by the violation message. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value to format as string | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the passed value | ### protected string formatValues(array $values, int $format = 0) Returns a string representation of a list of values. Each of the values is converted to a string using {@link formatValue()}. The values are then concatenated with commas. #### Parameters | | | | | --- | --- | --- | | array | $values | A list of values | | int | $format | A bitwise combination of the format constants in this class | #### Return Value | | | | --- | --- | | string | The string representation of the value list | #### See also | | | | --- | --- | | formatValue() | | ### validate(mixed $value, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint) Checks if the passed value is valid. #### Parameters | | | | | --- | --- | --- | | mixed | $value | The value that should be validated | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | The constraint for the validation | symfony PropertyPath PropertyPath ============= class **PropertyPath** Contains utility methods for dealing with property paths. For more extensive functionality, use Symfony's PropertyAccess component. Methods ------- | | | | | --- | --- | --- | | static string | [append](#method_append)(string $basePath, string $subPath) Appends a path to a given property path. | | Details ------- ### static string append(string $basePath, string $subPath) Appends a path to a given property path. If the base path is empty, the appended path will be returned unchanged. If the base path is not empty, and the appended path starts with a squared opening bracket ("["), the concatenation of the two paths is returned. Otherwise, the concatenation of the two paths is returned, separated by a dot ("."). #### Parameters | | | | | --- | --- | --- | | string | $basePath | The base path | | string | $subPath | The path to append | #### Return Value | | | | --- | --- | | string | The concatenation of the two property paths | symfony ConstraintViolationBuilder ConstraintViolationBuilder =========================== class **ConstraintViolationBuilder** implements [ConstraintViolationBuilderInterface](constraintviolationbuilderinterface "Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface") Default implementation of {@link ConstraintViolationBuilderInterface}. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([ConstraintViolationList](../constraintviolationlist "Symfony\Component\Validator\ConstraintViolationList") $violations, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, $translationDomain = null) | | | $this | [atPath](#method_atPath)(string $path) Stores the property path at which the violation should be generated. | | | $this | [setParameter](#method_setParameter)(string $key, string $value) Sets a parameter to be inserted into the violation message. | | | $this | [setParameters](#method_setParameters)(array $parameters) Sets all parameters to be inserted into the violation message. | | | $this | [setTranslationDomain](#method_setTranslationDomain)(string $translationDomain) Sets the translation domain which should be used for translating the violation message. | | | $this | [setInvalidValue](#method_setInvalidValue)(mixed $invalidValue) Sets the invalid value that caused this violation. | | | $this | [setPlural](#method_setPlural)(int $number) Sets the number which determines how the plural form of the violation message is chosen when it is translated. | | | $this | [setCode](#method_setCode)(string|null $code) Sets the violation code. | | | $this | [setCause](#method_setCause)(mixed $cause) Sets the cause of the violation. | | | | [addViolation](#method_addViolation)() Adds the violation to the current execution context. | | Details ------- ### \_\_construct([ConstraintViolationList](../constraintviolationlist "Symfony\Component\Validator\ConstraintViolationList") $violations, [Constraint](../constraint "Symfony\Component\Validator\Constraint") $constraint, $message, array $parameters, $root, $propertyPath, $invalidValue, [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") $translator, $translationDomain = null) #### Parameters | | | | | --- | --- | --- | | [ConstraintViolationList](../constraintviolationlist "Symfony\Component\Validator\ConstraintViolationList") | $violations | | | [Constraint](../constraint "Symfony\Component\Validator\Constraint") | $constraint | | | | $message | | | array | $parameters | | | | $root | | | | $propertyPath | | | | $invalidValue | | | [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | $translator | | | | $translationDomain | | ### $this atPath(string $path) Stores the property path at which the violation should be generated. The passed path will be appended to the current property path of the execution context. #### Parameters | | | | | --- | --- | --- | | string | $path | The property path | #### Return Value | | | | --- | --- | | $this | | ### $this setParameter(string $key, string $value) Sets a parameter to be inserted into the violation message. #### Parameters | | | | | --- | --- | --- | | string | $key | The name of the parameter | | string | $value | The value to be inserted in the parameter's place | #### Return Value | | | | --- | --- | | $this | | ### $this setParameters(array $parameters) Sets all parameters to be inserted into the violation message. #### Parameters | | | | | --- | --- | --- | | array | $parameters | An array with the parameter names as keys and the values to be inserted in their place as values | #### Return Value | | | | --- | --- | | $this | | ### $this setTranslationDomain(string $translationDomain) Sets the translation domain which should be used for translating the violation message. #### Parameters | | | | | --- | --- | --- | | string | $translationDomain | The translation domain | #### Return Value | | | | --- | --- | | $this | | ### $this setInvalidValue(mixed $invalidValue) Sets the invalid value that caused this violation. #### Parameters | | | | | --- | --- | --- | | mixed | $invalidValue | The invalid value | #### Return Value | | | | --- | --- | | $this | | ### $this setPlural(int $number) Sets the number which determines how the plural form of the violation message is chosen when it is translated. #### Parameters | | | | | --- | --- | --- | | int | $number | The number for determining the plural form | #### Return Value | | | | --- | --- | | $this | | ### $this setCode(string|null $code) Sets the violation code. #### Parameters | | | | | --- | --- | --- | | string|null | $code | The violation code | #### Return Value | | | | --- | --- | | $this | | ### $this setCause(mixed $cause) Sets the cause of the violation. #### Parameters | | | | | --- | --- | --- | | mixed | $cause | The cause of the violation | #### Return Value | | | | --- | --- | | $this | | ### addViolation() Adds the violation to the current execution context. symfony ConstraintViolationBuilderInterface ConstraintViolationBuilderInterface ==================================== interface **ConstraintViolationBuilderInterface** Builds {@link \Symfony\Component\Validator\ConstraintViolationInterface} objects. Use the various methods on this interface to configure the built violation. Finally, call {@link addViolation()} to add the violation to the current execution context. Methods ------- | | | | | --- | --- | --- | | $this | [atPath](#method_atPath)(string $path) Stores the property path at which the violation should be generated. | | | $this | [setParameter](#method_setParameter)(string $key, string $value) Sets a parameter to be inserted into the violation message. | | | $this | [setParameters](#method_setParameters)(array $parameters) Sets all parameters to be inserted into the violation message. | | | $this | [setTranslationDomain](#method_setTranslationDomain)(string $translationDomain) Sets the translation domain which should be used for translating the violation message. | | | $this | [setInvalidValue](#method_setInvalidValue)(mixed $invalidValue) Sets the invalid value that caused this violation. | | | $this | [setPlural](#method_setPlural)(int $number) Sets the number which determines how the plural form of the violation message is chosen when it is translated. | | | $this | [setCode](#method_setCode)(string|null $code) Sets the violation code. | | | $this | [setCause](#method_setCause)(mixed $cause) Sets the cause of the violation. | | | | [addViolation](#method_addViolation)() Adds the violation to the current execution context. | | Details ------- ### $this atPath(string $path) Stores the property path at which the violation should be generated. The passed path will be appended to the current property path of the execution context. #### Parameters | | | | | --- | --- | --- | | string | $path | The property path | #### Return Value | | | | --- | --- | | $this | | ### $this setParameter(string $key, string $value) Sets a parameter to be inserted into the violation message. #### Parameters | | | | | --- | --- | --- | | string | $key | The name of the parameter | | string | $value | The value to be inserted in the parameter's place | #### Return Value | | | | --- | --- | | $this | | ### $this setParameters(array $parameters) Sets all parameters to be inserted into the violation message. #### Parameters | | | | | --- | --- | --- | | array | $parameters | An array with the parameter names as keys and the values to be inserted in their place as values | #### Return Value | | | | --- | --- | | $this | | ### $this setTranslationDomain(string $translationDomain) Sets the translation domain which should be used for translating the violation message. #### Parameters | | | | | --- | --- | --- | | string | $translationDomain | The translation domain | #### Return Value | | | | --- | --- | | $this | | #### See also | | | | --- | --- | | [TranslatorInterface](../../translation/translatorinterface "Symfony\Component\Translation\TranslatorInterface") | | ### $this setInvalidValue(mixed $invalidValue) Sets the invalid value that caused this violation. #### Parameters | | | | | --- | --- | --- | | mixed | $invalidValue | The invalid value | #### Return Value | | | | --- | --- | | $this | | ### $this setPlural(int $number) Sets the number which determines how the plural form of the violation message is chosen when it is translated. #### Parameters | | | | | --- | --- | --- | | int | $number | The number for determining the plural form | #### Return Value | | | | --- | --- | | $this | | #### See also | | | | --- | --- | | [TranslatorInterface::transChoice](../../translation/translatorinterface#method_transChoice "Symfony\Component\Translation\TranslatorInterface") | | ### $this setCode(string|null $code) Sets the violation code. #### Parameters | | | | | --- | --- | --- | | string|null | $code | The violation code | #### Return Value | | | | --- | --- | | $this | | ### $this setCause(mixed $cause) Sets the cause of the violation. #### Parameters | | | | | --- | --- | --- | | mixed | $cause | The cause of the violation | #### Return Value | | | | --- | --- | | $this | | ### addViolation() Adds the violation to the current execution context. symfony AddConstraintValidatorsPass AddConstraintValidatorsPass ============================ class **AddConstraintValidatorsPass** implements [CompilerPassInterface](../../dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $validatorFactoryServiceId = 'validator.validator\_factory', string $constraintValidatorTag = 'validator.constraint\_validator') | | | | [process](#method_process)([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | | Details ------- ### \_\_construct(string $validatorFactoryServiceId = 'validator.validator\_factory', string $constraintValidatorTag = 'validator.constraint\_validator') #### Parameters | | | | | --- | --- | --- | | string | $validatorFactoryServiceId | | | string | $constraintValidatorTag | | ### process([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. #### Parameters | | | | | --- | --- | --- | | [ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | | symfony AddValidatorInitializersPass AddValidatorInitializersPass ============================= class **AddValidatorInitializersPass** implements [CompilerPassInterface](../../dependencyinjection/compiler/compilerpassinterface "Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $builderService = 'validator.builder', string $initializerTag = 'validator.initializer') | | | | [process](#method_process)([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. | | Details ------- ### \_\_construct(string $builderService = 'validator.builder', string $initializerTag = 'validator.initializer') #### Parameters | | | | | --- | --- | --- | | string | $builderService | | | string | $initializerTag | | ### process([ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") $container) You can modify the container here before it is dumped to PHP code. #### Parameters | | | | | --- | --- | --- | | [ContainerBuilder](../../dependencyinjection/containerbuilder "Symfony\Component\DependencyInjection\ContainerBuilder") | $container | | symfony InvalidArgumentException InvalidArgumentException ========================= class **InvalidArgumentException** extends [InvalidArgumentException](http://php.net/InvalidArgumentException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Validator\Exception\ExceptionInterface") Base InvalidArgumentException for the Validator component. symfony ExceptionInterface ExceptionInterface =================== interface **ExceptionInterface** Base ExceptionInterface for the Validator component. symfony MissingOptionsException MissingOptionsException ======================== class **MissingOptionsException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $message, array $options) | | | | [getOptions](#method_getOptions)() | | Details ------- ### \_\_construct(string $message, array $options) #### Parameters | | | | | --- | --- | --- | | string | $message | | | array | $options | | ### getOptions()
programming_docs
symfony RuntimeException RuntimeException ================= class **RuntimeException** extends [RuntimeException](http://php.net/RuntimeException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Validator\Exception\ExceptionInterface") Base RuntimeException for the Validator component. symfony UnsupportedMetadataException UnsupportedMetadataException ============================= class **UnsupportedMetadataException** extends [InvalidArgumentException](invalidargumentexception "Symfony\Component\Validator\Exception\InvalidArgumentException") symfony OutOfBoundsException OutOfBoundsException ===================== class **OutOfBoundsException** extends [OutOfBoundsException](http://php.net/OutOfBoundsException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Validator\Exception\ExceptionInterface") Base OutOfBoundsException for the Validator component. symfony MappingException MappingException ================= class **MappingException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") symfony BadMethodCallException BadMethodCallException ======================= class **BadMethodCallException** extends [BadMethodCallException](http://php.net/BadMethodCallException) implements [ExceptionInterface](exceptioninterface "Symfony\Component\Validator\Exception\ExceptionInterface") Base BadMethodCallException for the Validator component. symfony ValidatorException ValidatorException =================== class **ValidatorException** extends [RuntimeException](runtimeexception "Symfony\Component\Validator\Exception\RuntimeException") symfony InvalidOptionsException InvalidOptionsException ======================== class **InvalidOptionsException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(string $message, array $options) | | | | [getOptions](#method_getOptions)() | | Details ------- ### \_\_construct(string $message, array $options) #### Parameters | | | | | --- | --- | --- | | string | $message | | | array | $options | | ### getOptions() symfony NoSuchMetadataException NoSuchMetadataException ======================== class **NoSuchMetadataException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") symfony ConstraintDefinitionException ConstraintDefinitionException ============================== class **ConstraintDefinitionException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") symfony GroupDefinitionException GroupDefinitionException ========================= class **GroupDefinitionException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") symfony UnexpectedTypeException UnexpectedTypeException ======================== class **UnexpectedTypeException** extends [ValidatorException](validatorexception "Symfony\Component\Validator\Exception\ValidatorException") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)($value, string $expectedType) | | Details ------- ### \_\_construct($value, string $expectedType) #### Parameters | | | | | --- | --- | --- | | | $value | | | string | $expectedType | | symfony DoctrineProvider DoctrineProvider ================= class **DoctrineProvider** extends CacheProvider implements [PruneableInterface](pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](resettableinterface "Symfony\Component\Cache\ResettableInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(CacheItemPoolInterface $pool) | | | bool | [prune](#method_prune)() | | | | [reset](#method_reset)() | | | | [doFetch](#method_doFetch)($id) {@inheritdoc} | | | | [doContains](#method_doContains)($id) {@inheritdoc} | | | | [doSave](#method_doSave)($id, $data, $lifeTime = 0) {@inheritdoc} | | | | [doDelete](#method_doDelete)($id) {@inheritdoc} | | | | [doFlush](#method_doFlush)() {@inheritdoc} | | | | [doGetStats](#method_doGetStats)() {@inheritdoc} | | Details ------- ### \_\_construct(CacheItemPoolInterface $pool) #### Parameters | | | | | --- | --- | --- | | CacheItemPoolInterface | $pool | | ### bool prune() #### Return Value | | | | --- | --- | | bool | | ### reset() ### protected doFetch($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doContains($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doSave($id, $data, $lifeTime = 0) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | | | $data | | | | $lifeTime | | ### protected doDelete($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doFlush() {@inheritdoc} ### protected doGetStats() {@inheritdoc} symfony Symfony\Component\Cache\Exception Symfony\Component\Cache\Exception ================================= Classes ------- | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | | Exceptions ---------- | | | | --- | --- | | [CacheException](exception/cacheexception "Symfony\Component\Cache\Exception\CacheException") | | symfony Symfony\Component\Cache\DataCollector Symfony\Component\Cache\DataCollector ===================================== Classes ------- | | | | --- | --- | | [CacheDataCollector](datacollector/cachedatacollector "Symfony\Component\Cache\DataCollector\CacheDataCollector") | | symfony ResettableInterface ResettableInterface ==================== interface **ResettableInterface** Resets a pool's local state. Methods ------- | | | | | --- | --- | --- | | | [reset](#method_reset)() | | Details ------- ### reset() symfony CacheItem CacheItem ========== class **CacheItem** implements CacheItemInterface Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $key | | | | protected | $value | | | | protected | $isHit | | | | protected | $expiry | | | | protected | $defaultLifetime | | | | protected | $tags | | | | protected | $prevTags | | | | protected | $innerItem | | | | protected | $poolHash | | | Methods ------- | | | | | --- | --- | --- | | | [getKey](#method_getKey)() {@inheritdoc} | | | | [get](#method_get)() {@inheritdoc} | | | | [isHit](#method_isHit)() {@inheritdoc} | | | | [set](#method_set)($value) {@inheritdoc} | | | | [expiresAt](#method_expiresAt)($expiration) {@inheritdoc} | | | | [expiresAfter](#method_expiresAfter)($time) {@inheritdoc} | | | [CacheItem](cacheitem "Symfony\Component\Cache\CacheItem") | [tag](#method_tag)(string|string[] $tags) Adds a tag to a cache item. | | | array | [getPreviousTags](#method_getPreviousTags)() Returns the list of tags bound to the value coming from the pool storage if any. | | | static string | [validateKey](#method_validateKey)(string $key) Validates a cache key according to PSR-6. | | | static | [log](#method_log)(LoggerInterface $logger = null, $message, $context = array()) Internal logging helper. | | Details ------- ### getKey() {@inheritdoc} ### get() {@inheritdoc} ### isHit() {@inheritdoc} ### set($value) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $value | | ### expiresAt($expiration) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $expiration | | ### expiresAfter($time) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $time | | ### [CacheItem](cacheitem "Symfony\Component\Cache\CacheItem") tag(string|string[] $tags) Adds a tag to a cache item. #### Parameters | | | | | --- | --- | --- | | string|string[] | $tags | A tag or array of tags | #### Return Value | | | | --- | --- | | [CacheItem](cacheitem "Symfony\Component\Cache\CacheItem") | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | When $tag is not valid | ### array getPreviousTags() Returns the list of tags bound to the value coming from the pool storage if any. #### Return Value | | | | --- | --- | | array | | ### static string validateKey(string $key) Validates a cache key according to PSR-6. #### Parameters | | | | | --- | --- | --- | | string | $key | The key to validate | #### Return Value | | | | --- | --- | | string | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | When $key is not valid | ### static log(LoggerInterface $logger = null, $message, $context = array()) Internal logging helper. #### Parameters | | | | | --- | --- | --- | | LoggerInterface | $logger | | | | $message | | | | $context | | symfony PruneableInterface PruneableInterface =================== interface **PruneableInterface** Interface extends psr-6 and psr-16 caches to allow for pruning (deletion) of all expired cache items. Methods ------- | | | | | --- | --- | --- | | bool | [prune](#method_prune)() | | Details ------- ### bool prune() #### Return Value | | | | --- | --- | | bool | | symfony Symfony\Component\Cache\Adapter Symfony\Component\Cache\Adapter =============================== Classes ------- | | | | --- | --- | | [AbstractAdapter](adapter/abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [ApcuAdapter](adapter/apcuadapter "Symfony\Component\Cache\Adapter\ApcuAdapter") | | | [ArrayAdapter](adapter/arrayadapter "Symfony\Component\Cache\Adapter\ArrayAdapter") | | | [ChainAdapter](adapter/chainadapter "Symfony\Component\Cache\Adapter\ChainAdapter") | Chains several adapters together. | | [DoctrineAdapter](adapter/doctrineadapter "Symfony\Component\Cache\Adapter\DoctrineAdapter") | | | [FilesystemAdapter](adapter/filesystemadapter "Symfony\Component\Cache\Adapter\FilesystemAdapter") | | | [MemcachedAdapter](adapter/memcachedadapter "Symfony\Component\Cache\Adapter\MemcachedAdapter") | | | [NullAdapter](adapter/nulladapter "Symfony\Component\Cache\Adapter\NullAdapter") | | | [PdoAdapter](adapter/pdoadapter "Symfony\Component\Cache\Adapter\PdoAdapter") | | | [PhpArrayAdapter](adapter/phparrayadapter "Symfony\Component\Cache\Adapter\PhpArrayAdapter") | Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. | | [PhpFilesAdapter](adapter/phpfilesadapter "Symfony\Component\Cache\Adapter\PhpFilesAdapter") | | | [ProxyAdapter](adapter/proxyadapter "Symfony\Component\Cache\Adapter\ProxyAdapter") | | | [RedisAdapter](adapter/redisadapter "Symfony\Component\Cache\Adapter\RedisAdapter") | | | [SimpleCacheAdapter](adapter/simplecacheadapter "Symfony\Component\Cache\Adapter\SimpleCacheAdapter") | | | [TagAwareAdapter](adapter/tagawareadapter "Symfony\Component\Cache\Adapter\TagAwareAdapter") | | | [TraceableAdapter](adapter/traceableadapter "Symfony\Component\Cache\Adapter\TraceableAdapter") | An adapter that collects data about all cache calls. | | [TraceableAdapterEvent](adapter/traceableadapterevent "Symfony\Component\Cache\Adapter\TraceableAdapterEvent") | | | [TraceableTagAwareAdapter](adapter/traceabletagawareadapter "Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter") | | Interfaces ---------- | | | | --- | --- | | *[AdapterInterface](adapter/adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface")* | Interface for adapters managing instances of Symfony's CacheItem. | | *[TagAwareAdapterInterface](adapter/tagawareadapterinterface "Symfony\Component\Cache\Adapter\TagAwareAdapterInterface")* | Interface for invalidating cached items using tags. | symfony Symfony\Component\Cache\Traits Symfony\Component\Cache\Traits ============================== Classes ------- | | | | --- | --- | | [AbstractTrait](traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | [ApcuTrait](traits/apcutrait "Symfony\Component\Cache\Traits\ApcuTrait") | | | [ArrayTrait](traits/arraytrait "Symfony\Component\Cache\Traits\ArrayTrait") | | | [DoctrineTrait](traits/doctrinetrait "Symfony\Component\Cache\Traits\DoctrineTrait") | | | [FilesystemCommonTrait](traits/filesystemcommontrait "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [FilesystemTrait](traits/filesystemtrait "Symfony\Component\Cache\Traits\FilesystemTrait") | | | [MemcachedTrait](traits/memcachedtrait "Symfony\Component\Cache\Traits\MemcachedTrait") | | | [PdoTrait](traits/pdotrait "Symfony\Component\Cache\Traits\PdoTrait") | | | [PhpArrayTrait](traits/phparraytrait "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [PhpFilesTrait](traits/phpfilestrait "Symfony\Component\Cache\Traits\PhpFilesTrait") | | | [ProxyTrait](traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | | [RedisProxy](traits/redisproxy "Symfony\Component\Cache\Traits\RedisProxy") | | | [RedisTrait](traits/redistrait "Symfony\Component\Cache\Traits\RedisTrait") | | symfony Symfony\Component\Cache\Simple Symfony\Component\Cache\Simple ============================== Classes ------- | | | | --- | --- | | [AbstractCache](simple/abstractcache "Symfony\Component\Cache\Simple\AbstractCache") | | | [ApcuCache](simple/apcucache "Symfony\Component\Cache\Simple\ApcuCache") | | | [ArrayCache](simple/arraycache "Symfony\Component\Cache\Simple\ArrayCache") | | | [ChainCache](simple/chaincache "Symfony\Component\Cache\Simple\ChainCache") | Chains several caches together. | | [DoctrineCache](simple/doctrinecache "Symfony\Component\Cache\Simple\DoctrineCache") | | | [FilesystemCache](simple/filesystemcache "Symfony\Component\Cache\Simple\FilesystemCache") | | | [MemcachedCache](simple/memcachedcache "Symfony\Component\Cache\Simple\MemcachedCache") | | | [NullCache](simple/nullcache "Symfony\Component\Cache\Simple\NullCache") | | | [PdoCache](simple/pdocache "Symfony\Component\Cache\Simple\PdoCache") | | | [PhpArrayCache](simple/phparraycache "Symfony\Component\Cache\Simple\PhpArrayCache") | Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. | | [PhpFilesCache](simple/phpfilescache "Symfony\Component\Cache\Simple\PhpFilesCache") | | | [Psr6Cache](simple/psr6cache "Symfony\Component\Cache\Simple\Psr6Cache") | | | [RedisCache](simple/rediscache "Symfony\Component\Cache\Simple\RedisCache") | | | [TraceableCache](simple/traceablecache "Symfony\Component\Cache\Simple\TraceableCache") | An adapter that collects data about all cache calls. | | [TraceableCacheEvent](simple/traceablecacheevent "Symfony\Component\Cache\Simple\TraceableCacheEvent") | | symfony CacheDataCollector CacheDataCollector =================== class **CacheDataCollector** extends [DataCollector](../../httpkernel/datacollector/datacollector "Symfony\Component\HttpKernel\DataCollector\DataCollector") implements [LateDataCollectorInterface](../../httpkernel/datacollector/latedatacollectorinterface "Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface") Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $data | | from [DataCollector](../../httpkernel/datacollector/datacollector#property_data "Symfony\Component\HttpKernel\DataCollector\DataCollector") | Methods ------- | | | | | --- | --- | --- | | | [serialize](#method_serialize)() | from [DataCollector](../../httpkernel/datacollector/datacollector#method_serialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | | [unserialize](#method_unserialize)($data) | from [DataCollector](../../httpkernel/datacollector/datacollector#method_unserialize "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | [cloneVar](#method_cloneVar)(mixed $var) Converts the variable into a serializable Data instance. | from [DataCollector](../../httpkernel/datacollector/datacollector#method_cloneVar "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | callable[] | [getCasters](#method_getCasters)() | from [DataCollector](../../httpkernel/datacollector/datacollector#method_getCasters "Symfony\Component\HttpKernel\DataCollector\DataCollector") | | | [addInstance](#method_addInstance)(string $name, [TraceableAdapter](../adapter/traceableadapter "Symfony\Component\Cache\Adapter\TraceableAdapter") $instance) | | | | [collect](#method_collect)([Request](../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. | | | | [reset](#method_reset)() Resets this data collector to its initial state. | | | | [lateCollect](#method_lateCollect)() Collects data as late as possible. | | | string | [getName](#method_getName)() Returns the name of the collector. | | | array | [getStatistics](#method_getStatistics)() Method returns amount of logged Cache reads: "get" calls. | | | array | [getTotals](#method_getTotals)() Method returns the statistic totals. | | | mixed | [getCalls](#method_getCalls)() Method returns all logged Cache call objects. | | Details ------- ### serialize() ### unserialize($data) #### Parameters | | | | | --- | --- | --- | | | $data | | ### protected [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") cloneVar(mixed $var) Converts the variable into a serializable Data instance. This array can be displayed in the template using the VarDumper component. #### Parameters | | | | | --- | --- | --- | | mixed | $var | | #### Return Value | | | | --- | --- | | [Data](../../vardumper/cloner/data "Symfony\Component\VarDumper\Cloner\Data") | | ### protected callable[] getCasters() #### Return Value | | | | --- | --- | | callable[] | The casters to add to the cloner | ### addInstance(string $name, [TraceableAdapter](../adapter/traceableadapter "Symfony\Component\Cache\Adapter\TraceableAdapter") $instance) #### Parameters | | | | | --- | --- | --- | | string | $name | | | [TraceableAdapter](../adapter/traceableadapter "Symfony\Component\Cache\Adapter\TraceableAdapter") | $instance | | ### collect([Request](../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") $request, [Response](../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") $response, [Exception](http://php.net/Exception) $exception = null) Collects data for the given Request and Response. #### Parameters | | | | | --- | --- | --- | | [Request](../../httpfoundation/request "Symfony\Component\HttpFoundation\Request") | $request | | | [Response](../../httpfoundation/response "Symfony\Component\HttpFoundation\Response") | $response | | | [Exception](http://php.net/Exception) | $exception | | ### reset() Resets this data collector to its initial state. ### lateCollect() Collects data as late as possible. ### string getName() Returns the name of the collector. #### Return Value | | | | --- | --- | | string | The collector name | ### array getStatistics() Method returns amount of logged Cache reads: "get" calls. #### Return Value | | | | --- | --- | | array | | ### array getTotals() Method returns the statistic totals. #### Return Value | | | | --- | --- | | array | | ### mixed getCalls() Method returns all logged Cache call objects. #### Return Value | | | | --- | --- | | mixed | |
programming_docs
symfony ProxyTrait ProxyTrait =========== trait **ProxyTrait** Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | | | | [reset](#method_reset)() {@inheritdoc} | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} symfony AbstractTrait AbstractTrait ============== trait **AbstractTrait** Traits ------ | | | | --- | --- | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | | | | [reset](#method_reset)() {@inheritdoc} | | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | symfony PhpFilesTrait PhpFilesTrait ============== trait **PhpFilesTrait** Traits ------ | | | | --- | --- | | [FilesystemCommonTrait](filesystemcommontrait "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | Methods ------- | | | | | --- | --- | --- | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | from [FilesystemCommonTrait](filesystemcommontrait#method_doClear "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | from [FilesystemCommonTrait](filesystemcommontrait#method_doDelete "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | static | [throwError](#method_throwError)($type, $message, $file, $line) | from [FilesystemCommonTrait](filesystemcommontrait#method_throwError "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [\_\_destruct](#method___destruct)() | from [FilesystemCommonTrait](filesystemcommontrait#method___destruct "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | static | [isSupported](#method_isSupported)() | | | bool | [prune](#method_prune)() | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | Details ------- ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### static throwError($type, $message, $file, $line) #### Parameters | | | | | --- | --- | --- | | | $type | | | | $message | | | | $file | | | | $line | | ### \_\_destruct() ### static isSupported() ### bool prune() #### Return Value | | | | --- | --- | | bool | | ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | symfony MemcachedTrait MemcachedTrait =============== trait **MemcachedTrait** Methods ------- | | | | | --- | --- | --- | | static | [isSupported](#method_isSupported)() | | | static Memcached | [createConnection](#method_createConnection)(array[]|string|string[] $servers, array $options = array()) Creates a Memcached instance. | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | | Details ------- ### static isSupported() ### static Memcached createConnection(array[]|string|string[] $servers, array $options = array()) Creates a Memcached instance. By default, the binary protocol, no block, and libketama compatible options are enabled. Examples for servers: - 'memcached://user:pass@localhost?weight=33' - array(array('localhost', 11211, 33)) #### Parameters | | | | | --- | --- | --- | | array[]|string|string[] | $servers | An array of servers, a DSN, or an array of DSNs | | array | $options | An array of options | #### Return Value | | | | --- | --- | | Memcached | | #### Exceptions | | | | --- | --- | | [ErrorException](http://php.net/ErrorException) | When invalid options or servers are provided | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | symfony DoctrineTrait DoctrineTrait ============== trait **DoctrineTrait** Methods ------- | | | | | --- | --- | --- | | | [reset](#method_reset)() {@inheritdoc} | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | Details ------- ### reset() {@inheritdoc} ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | symfony ApcuTrait ApcuTrait ========== trait **ApcuTrait** Methods ------- | | | | | --- | --- | --- | | static | [isSupported](#method_isSupported)() | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | Details ------- ### static isSupported() ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | symfony PdoTrait PdoTrait ========= trait **PdoTrait** Methods ------- | | | | | --- | --- | --- | | | [createTable](#method_createTable)() Creates the table to store cache items which can be called once for setup. | | | | [prune](#method_prune)() {@inheritdoc} | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | Details ------- ### createTable() Creates the table to store cache items which can be called once for setup. Cache ID are saved in a column of maximum length 255. Cache data is saved in a BLOB. #### Exceptions | | | | --- | --- | | [PDOException](http://php.net/PDOException) | When the table already exists | | DBALException | When the table already exists | | [DomainException](http://php.net/DomainException) | When an unsupported PDO driver is used | ### prune() {@inheritdoc} ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | symfony FilesystemTrait FilesystemTrait ================ trait **FilesystemTrait** Traits ------ | | | | --- | --- | | [FilesystemCommonTrait](filesystemcommontrait "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | Methods ------- | | | | | --- | --- | --- | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | from [FilesystemCommonTrait](filesystemcommontrait#method_doClear "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | from [FilesystemCommonTrait](filesystemcommontrait#method_doDelete "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | static | [throwError](#method_throwError)($type, $message, $file, $line) | from [FilesystemCommonTrait](filesystemcommontrait#method_throwError "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [\_\_destruct](#method___destruct)() | from [FilesystemCommonTrait](filesystemcommontrait#method___destruct "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | bool | [prune](#method_prune)() | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | Details ------- ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### static throwError($type, $message, $file, $line) #### Parameters | | | | | --- | --- | --- | | | $type | | | | $message | | | | $file | | | | $line | | ### \_\_destruct() ### bool prune() #### Return Value | | | | --- | --- | | bool | | ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | symfony RedisProxy RedisProxy =========== class **RedisProxy** Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(Redis $redis, [Closure](http://php.net/Closure) $initializer) | | | | [\_\_call](#method___call)($method, array $args) | | | | [hscan](#method_hscan)($strKey, $iIterator, $strPattern = null, $iCount = null) | | | | [scan](#method_scan)($iIterator, $strPattern = null, $iCount = null) | | | | [sscan](#method_sscan)($strKey, $iIterator, $strPattern = null, $iCount = null) | | | | [zscan](#method_zscan)($strKey, $iIterator, $strPattern = null, $iCount = null) | | Details ------- ### \_\_construct(Redis $redis, [Closure](http://php.net/Closure) $initializer) #### Parameters | | | | | --- | --- | --- | | Redis | $redis | | | [Closure](http://php.net/Closure) | $initializer | | ### \_\_call($method, array $args) #### Parameters | | | | | --- | --- | --- | | | $method | | | array | $args | | ### hscan($strKey, $iIterator, $strPattern = null, $iCount = null) #### Parameters | | | | | --- | --- | --- | | | $strKey | | | | $iIterator | | | | $strPattern | | | | $iCount | | ### scan($iIterator, $strPattern = null, $iCount = null) #### Parameters | | | | | --- | --- | --- | | | $iIterator | | | | $strPattern | | | | $iCount | | ### sscan($strKey, $iIterator, $strPattern = null, $iCount = null) #### Parameters | | | | | --- | --- | --- | | | $strKey | | | | $iIterator | | | | $strPattern | | | | $iCount | | ### zscan($strKey, $iIterator, $strPattern = null, $iCount = null) #### Parameters | | | | | --- | --- | --- | | | $strKey | | | | $iIterator | | | | $strPattern | | | | $iCount | | symfony RedisTrait RedisTrait =========== trait **RedisTrait** Methods ------- | | | | | --- | --- | --- | | static Redis|Client | [createConnection](#method_createConnection)(string $dsn, array $options = array()) Creates a Redis connection using a DSN configuration. | | | | [doFetch](#method_doFetch)(array $ids) {@inheritdoc} | | | | [doHave](#method_doHave)($id) {@inheritdoc} | | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | | | | [doSave](#method_doSave)(array $values, $lifetime) {@inheritdoc} | | Details ------- ### static Redis|Client createConnection(string $dsn, array $options = array()) Creates a Redis connection using a DSN configuration. Example DSN: - redis://localhost - redis://example.com:1234 - redis://[email protected]/13 - redis:///var/run/redis.sock - redis://secret@/var/run/redis.sock/13 #### Parameters | | | | | --- | --- | --- | | string | $dsn | | | array | $options | See self::$defaultConnectionOptions | #### Return Value | | | | --- | --- | | Redis|Client | According to the "class" option | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | when the DSN is invalid | ### protected doFetch(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doHave($id) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $id | | ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### protected doSave(array $values, $lifetime) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $values | | | | $lifetime | | symfony ArrayTrait ArrayTrait =========== trait **ArrayTrait** Traits ------ | | | | --- | --- | | LoggerAwareTrait | | Methods ------- | | | | | --- | --- | --- | | array | [getValues](#method_getValues)() Returns all cached values, with cache miss as null. | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [reset](#method_reset)() {@inheritdoc} | | Details ------- ### array getValues() Returns all cached values, with cache miss as null. #### Return Value | | | | --- | --- | | array | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### reset() {@inheritdoc}
programming_docs
symfony PhpArrayTrait PhpArrayTrait ============== trait **PhpArrayTrait** Traits ------ | | | | --- | --- | | [ProxyTrait](proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ProxyTrait](proxytrait#method_reset "Symfony\Component\Cache\Traits\ProxyTrait") | | | [warmUp](#method_warmUp)(array $values) Store an array of cached values. | | | | [clear](#method_clear)() {@inheritdoc} | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} ### warmUp(array $values) Store an array of cached values. #### Parameters | | | | | --- | --- | --- | | array | $values | The cached values | ### clear() {@inheritdoc} symfony FilesystemCommonTrait FilesystemCommonTrait ====================== trait **FilesystemCommonTrait** Methods ------- | | | | | --- | --- | --- | | | [doClear](#method_doClear)($namespace) {@inheritdoc} | | | | [doDelete](#method_doDelete)(array $ids) {@inheritdoc} | | | static | [throwError](#method_throwError)($type, $message, $file, $line) | | | | [\_\_destruct](#method___destruct)() | | Details ------- ### protected doClear($namespace) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $namespace | | ### protected doDelete(array $ids) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $ids | | ### static throwError($type, $message, $file, $line) #### Parameters | | | | | --- | --- | --- | | | $type | | | | $message | | | | $file | | | | $line | | ### \_\_destruct() symfony TagAwareAdapter TagAwareAdapter ================ class **TagAwareAdapter** implements [TagAwareAdapterInterface](tagawareadapterinterface "Symfony\Component\Cache\Adapter\TagAwareAdapterInterface"), [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [ProxyTrait](../traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | Constants --------- | | | | --- | --- | | TAGS\_PREFIX | | Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_reset "Symfony\Component\Cache\Traits\ProxyTrait") | | | [\_\_construct](#method___construct)([AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $itemsPool, [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $tagsPool = null, float $knownTagVersionsTtl = 0.15) | | | bool | [invalidateTags](#method_invalidateTags)(array $tags) Invalidates cached items using tags. | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | | | [\_\_destruct](#method___destruct)() | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} ### \_\_construct([AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $itemsPool, [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $tagsPool = null, float $knownTagVersionsTtl = 0.15) #### Parameters | | | | | --- | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | $itemsPool | | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | $tagsPool | | | float | $knownTagVersionsTtl | | ### bool invalidateTags(array $tags) Invalidates cached items using tags. #### Parameters | | | | | --- | --- | --- | | array | $tags | An array of tags to invalidate | #### Return Value | | | | --- | --- | | bool | True on success | #### Exceptions | | | | --- | --- | | InvalidArgumentException | When $tags is not valid | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() symfony DoctrineAdapter DoctrineAdapter ================ class **DoctrineAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") Traits ------ | | | | --- | --- | | [DoctrineTrait](../traits/doctrinetrait "Symfony\Component\Cache\Traits\DoctrineTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(CacheProvider $provider, string $namespace = '', int $defaultLifetime = 0) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | from [AbstractAdapter](abstractadapter#method_createConnection "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [AbstractAdapter](abstractadapter#method___destruct "Symfony\Component\Cache\Adapter\AbstractAdapter") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(CacheProvider $provider, string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | CacheProvider | $provider | | | string | $namespace | | | int | $defaultLifetime | | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() symfony NullAdapter NullAdapter ============ class **NullAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)() | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | Details ------- ### \_\_construct() ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} symfony PhpArrayAdapter PhpArrayAdapter ================ class **PhpArrayAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface"), [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. Warmed up items are read-only and run-time discovered items are cached using a fallback adapter. Traits ------ | | | | --- | --- | | [PhpArrayTrait](../traits/phparraytrait "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [ProxyTrait](../traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_reset "Symfony\Component\Cache\Traits\ProxyTrait") | | | [warmUp](#method_warmUp)(array $values) Store an array of cached values. | from [PhpArrayTrait](../traits/phparraytrait#method_warmUp "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [PhpArrayTrait](../traits/phparraytrait#method_clear "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [\_\_construct](#method___construct)(string $file, [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $fallbackPool) | | | static CacheItemPoolInterface | [create](#method_create)(string $file, CacheItemPoolInterface $fallbackPool) This adapter takes advantage of how PHP stores arrays in its latest versions. | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | | static | [throwOnRequiredClass](#method_throwOnRequiredClass)($class) | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} ### warmUp(array $values) Store an array of cached values. #### Parameters | | | | | --- | --- | --- | | array | $values | The cached values | ### clear() {@inheritdoc} ### \_\_construct(string $file, [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $fallbackPool) #### Parameters | | | | | --- | --- | --- | | string | $file | The PHP file were values are cached | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | $fallbackPool | A pool to fallback on when an item is not hit | ### static CacheItemPoolInterface create(string $file, CacheItemPoolInterface $fallbackPool) This adapter takes advantage of how PHP stores arrays in its latest versions. #### Parameters | | | | | --- | --- | --- | | string | $file | The PHP file were values are cached | | CacheItemPoolInterface | $fallbackPool | Fallback when opcache is disabled | #### Return Value | | | | --- | --- | | CacheItemPoolInterface | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### static throwOnRequiredClass($class) #### Parameters | | | | | --- | --- | --- | | | $class | | #### Exceptions | | | | --- | --- | | [ReflectionException](http://php.net/ReflectionException) | When $class is not found and is required |
programming_docs
symfony ChainAdapter ChainAdapter ============= class **ChainAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface"), [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Chains several adapters together. Cached items are fetched from the first adapter having them in its data store. They are saved and deleted in all adapters at once. Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)(array $adapters, int $defaultLifetime = 0) | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | | bool | [prune](#method_prune)() | | | | [reset](#method_reset)() | | Details ------- ### \_\_construct(array $adapters, int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | array | $adapters | The ordered list of adapters used to fetch cached items | | int | $defaultLifetime | The default lifetime of items propagated from lower adapters to upper ones | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### bool prune() #### Return Value | | | | --- | --- | | bool | | ### reset() symfony ApcuAdapter ApcuAdapter ============ class **ApcuAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") Traits ------ | | | | --- | --- | | [ApcuTrait](../traits/apcutrait "Symfony\Component\Cache\Traits\ApcuTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(string $namespace = '', int $defaultLifetime = 0, string $version = null) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | from [AbstractAdapter](abstractadapter#method_createConnection "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [AbstractAdapter](abstractadapter#method___destruct "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [isSupported](#method_isSupported)() | from [ApcuTrait](../traits/apcutrait#method_isSupported "Symfony\Component\Cache\Traits\ApcuTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(string $namespace = '', int $defaultLifetime = 0, string $version = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | #### Exceptions | | | | --- | --- | | CacheException | if APCu is not enabled | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() ### static isSupported() symfony AdapterInterface AdapterInterface ================= interface **AdapterInterface** implements CacheItemPoolInterface Interface for adapters managing instances of Symfony's CacheItem. Methods ------- | | | | | --- | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | Details ------- ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | symfony FilesystemAdapter FilesystemAdapter ================== class **FilesystemAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") implements [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface") Traits ------ | | | | --- | --- | | [FilesystemTrait](../traits/filesystemtrait "Symfony\Component\Cache\Traits\FilesystemTrait") | | | [FilesystemCommonTrait](../traits/filesystemcommontrait "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(string $namespace = '', int $defaultLifetime = 0, string $directory = null) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | from [AbstractAdapter](abstractadapter#method_createConnection "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [FilesystemCommonTrait](../traits/filesystemcommontrait#method___destruct "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | static | [throwError](#method_throwError)($type, $message, $file, $line) | from [FilesystemCommonTrait](../traits/filesystemcommontrait#method_throwError "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | bool | [prune](#method_prune)() | from [FilesystemTrait](../traits/filesystemtrait#method_prune "Symfony\Component\Cache\Traits\FilesystemTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $directory | | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() ### static throwError($type, $message, $file, $line) #### Parameters | | | | | --- | --- | --- | | | $type | | | | $message | | | | $file | | | | $line | | ### bool prune() #### Return Value | | | | --- | --- | | bool | |
programming_docs
symfony PdoAdapter PdoAdapter =========== class **PdoAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") implements [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface") Traits ------ | | | | --- | --- | | [PdoTrait](../traits/pdotrait "Symfony\Component\Cache\Traits\PdoTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $maxIdLength | | | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array()) You can either pass an existing database connection as PDO instance or a Doctrine DBAL Connection or a DSN string that will be used to lazy-connect to the database when the cache is actually used. | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | from [AbstractAdapter](abstractadapter#method_createConnection "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [AbstractAdapter](abstractadapter#method___destruct "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [createTable](#method_createTable)() Creates the table to store cache items which can be called once for setup. | from [PdoTrait](../traits/pdotrait#method_createTable "Symfony\Component\Cache\Traits\PdoTrait") | | | [prune](#method_prune)() {@inheritdoc} | from [PdoTrait](../traits/pdotrait#method_prune "Symfony\Component\Cache\Traits\PdoTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array()) You can either pass an existing database connection as PDO instance or a Doctrine DBAL Connection or a DSN string that will be used to lazy-connect to the database when the cache is actually used. List of available options: \* db\_table: The name of the table [default: cache\_items] \* db\_id\_col: The column where to store the cache id [default: item\_id] \* db\_data\_col: The column where to store the cache data [default: item\_data] \* db\_lifetime\_col: The column where to store the lifetime [default: item\_lifetime] \* db\_time\_col: The column where to store the timestamp [default: item\_time] \* db\_username: The username when lazy-connect [default: ''] \* db\_password: The password when lazy-connect [default: ''] \* db\_connection\_options: An array of driver-specific connection options [default: array()] #### Parameters | | | | | --- | --- | --- | | | $connOrDsn | | | string | $namespace | | | int | $defaultLifetime | | | array | $options | | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | When first argument is not PDO nor Connection nor string | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | When PDO error mode is not PDO::ERRMODE\_EXCEPTION | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | When namespace contains invalid characters | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() ### createTable() Creates the table to store cache items which can be called once for setup. Cache ID are saved in a column of maximum length 255. Cache data is saved in a BLOB. #### Exceptions | | | | --- | --- | | [PDOException](http://php.net/PDOException) | When the table already exists | | DBALException | When the table already exists | | [DomainException](http://php.net/DomainException) | When an unsupported PDO driver is used | ### prune() {@inheritdoc} symfony TraceableAdapter TraceableAdapter ================= class **TraceableAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface"), [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") An adapter that collects data about all cache calls. Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $pool | | | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $pool) | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | | bool | [prune](#method_prune)() | | | | [reset](#method_reset)() | | | | [getCalls](#method_getCalls)() | | | | [clearCalls](#method_clearCalls)() | | | | [start](#method_start)($name) | | Details ------- ### \_\_construct([AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $pool) #### Parameters | | | | | --- | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | $pool | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### clear() {@inheritdoc} ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### commit() {@inheritdoc} ### bool prune() #### Return Value | | | | --- | --- | | bool | | ### reset() ### getCalls() ### clearCalls() ### protected start($name) #### Parameters | | | | | --- | --- | --- | | | $name | | symfony AbstractAdapter AbstractAdapter ================ abstract class **AbstractAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface"), LoggerAwareInterface, [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(string $namespace = '', int $defaultLifetime = 0) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | | | [\_\_destruct](#method___destruct)() | | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### protected \_\_construct(string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct()
programming_docs
symfony MemcachedAdapter MemcachedAdapter ================= class **MemcachedAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") Traits ------ | | | | --- | --- | | [MemcachedTrait](../traits/memcachedtrait "Symfony\Component\Cache\Traits\MemcachedTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $maxIdLength | | | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(Memcached $client, string $namespace = '', int $defaultLifetime = 0) Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged. | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static Memcached | [createConnection](#method_createConnection)(array[]|string|string[] $servers, array $options = array()) Creates a Memcached instance. | from [MemcachedTrait](../traits/memcachedtrait#method_createConnection "Symfony\Component\Cache\Traits\MemcachedTrait") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [AbstractAdapter](abstractadapter#method___destruct "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [isSupported](#method_isSupported)() | from [MemcachedTrait](../traits/memcachedtrait#method_isSupported "Symfony\Component\Cache\Traits\MemcachedTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(Memcached $client, string $namespace = '', int $defaultLifetime = 0) Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged. Using a RedisAdapter is recommended instead. If you cannot do otherwise, be aware that: - the Memcached::OPT\_BINARY\_PROTOCOL must be enabled (that's the default when using MemcachedAdapter::createConnection()); - tags eviction by Memcached's LRU algorithm will break by-tags invalidation; your Memcached memory should be large enough to never trigger LRU. Using a MemcachedAdapter as a pure items store is fine. #### Parameters | | | | | --- | --- | --- | | Memcached | $client | | | string | $namespace | | | int | $defaultLifetime | | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static Memcached createConnection(array[]|string|string[] $servers, array $options = array()) Creates a Memcached instance. By default, the binary protocol, no block, and libketama compatible options are enabled. Examples for servers: - 'memcached://user:pass@localhost?weight=33' - array(array('localhost', 11211, 33)) #### Parameters | | | | | --- | --- | --- | | array[]|string|string[] | $servers | An array of servers, a DSN, or an array of DSNs | | array | $options | An array of options | #### Return Value | | | | --- | --- | | Memcached | | #### Exceptions | | | | --- | --- | | [ErrorException](http://php.net/ErrorException) | When invalid options or servers are provided | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() ### static isSupported() symfony TraceableAdapterEvent TraceableAdapterEvent ====================== class **TraceableAdapterEvent** Properties ---------- | | | | | | --- | --- | --- | --- | | | $name | | | | | $start | | | | | $end | | | | | $result | | | | | $hits | | | | | $misses | | | symfony TraceableTagAwareAdapter TraceableTagAwareAdapter ========================= class **TraceableTagAwareAdapter** extends [TraceableAdapter](traceableadapter "Symfony\Component\Cache\Adapter\TraceableAdapter") implements [TagAwareAdapterInterface](tagawareadapterinterface "Symfony\Component\Cache\Adapter\TagAwareAdapterInterface") Properties ---------- | | | | | | --- | --- | --- | --- | | protected | $pool | | from [TraceableAdapter](traceableadapter#property_pool "Symfony\Component\Cache\Adapter\TraceableAdapter") | Methods ------- | | | | | --- | --- | --- | | | [\_\_construct](#method___construct)([AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $pool) | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_getItem "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_hasItem "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_deleteItem "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_save "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\TraceableAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_getItems "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [clear](#method_clear)() {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_clear "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_deleteItems "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [TraceableAdapter](traceableadapter#method_commit "Symfony\Component\Cache\Adapter\TraceableAdapter") | | bool | [prune](#method_prune)() | from [TraceableAdapter](traceableadapter#method_prune "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [reset](#method_reset)() | from [TraceableAdapter](traceableadapter#method_reset "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [getCalls](#method_getCalls)() | from [TraceableAdapter](traceableadapter#method_getCalls "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [clearCalls](#method_clearCalls)() | from [TraceableAdapter](traceableadapter#method_clearCalls "Symfony\Component\Cache\Adapter\TraceableAdapter") | | | [start](#method_start)($name) | from [TraceableAdapter](traceableadapter#method_start "Symfony\Component\Cache\Adapter\TraceableAdapter") | | bool | [invalidateTags](#method_invalidateTags)(array $tags) Invalidates cached items using tags. | | Details ------- ### \_\_construct([AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") $pool) #### Parameters | | | | | --- | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | $pool | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### clear() {@inheritdoc} ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### commit() {@inheritdoc} ### bool prune() #### Return Value | | | | --- | --- | | bool | | ### reset() ### getCalls() ### clearCalls() ### protected start($name) #### Parameters | | | | | --- | --- | --- | | | $name | | ### bool invalidateTags(array $tags) Invalidates cached items using tags. #### Parameters | | | | | --- | --- | --- | | array | $tags | An array of tags to invalidate | #### Return Value | | | | --- | --- | | bool | True on success | #### Exceptions | | | | --- | --- | | InvalidArgumentException | When $tags is not valid | symfony TagAwareAdapterInterface TagAwareAdapterInterface ========================= interface **TagAwareAdapterInterface** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") Interface for invalidating cached items using tags. Methods ------- | | | | | --- | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AdapterInterface](adapterinterface#method_getItem "Symfony\Component\Cache\Adapter\AdapterInterface") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AdapterInterface](adapterinterface#method_getItems "Symfony\Component\Cache\Adapter\AdapterInterface") | | bool | [invalidateTags](#method_invalidateTags)(array $tags) Invalidates cached items using tags. | | Details ------- ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### bool invalidateTags(array $tags) Invalidates cached items using tags. #### Parameters | | | | | --- | --- | --- | | array | $tags | An array of tags to invalidate | #### Return Value | | | | --- | --- | | bool | True on success | #### Exceptions | | | | --- | --- | | InvalidArgumentException | When $tags is not valid | symfony ArrayAdapter ArrayAdapter ============= class **ArrayAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface"), LoggerAwareInterface, [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [ArrayTrait](../traits/arraytrait "Symfony\Component\Cache\Traits\ArrayTrait") | | | LoggerAwareTrait | | Methods ------- | | | | | --- | --- | --- | | array | [getValues](#method_getValues)() Returns all cached values, with cache miss as null. | from [ArrayTrait](../traits/arraytrait#method_getValues "Symfony\Component\Cache\Traits\ArrayTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_hasItem "Symfony\Component\Cache\Traits\ArrayTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_clear "Symfony\Component\Cache\Traits\ArrayTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_deleteItem "Symfony\Component\Cache\Traits\ArrayTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_reset "Symfony\Component\Cache\Traits\ArrayTrait") | | | [\_\_construct](#method___construct)(int $defaultLifetime = 0, bool $storeSerialized = true) | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | Details ------- ### array getValues() Returns all cached values, with cache miss as null. #### Return Value | | | | --- | --- | | array | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### reset() {@inheritdoc} ### \_\_construct(int $defaultLifetime = 0, bool $storeSerialized = true) #### Parameters | | | | | --- | --- | --- | | int | $defaultLifetime | | | bool | $storeSerialized | Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc}
programming_docs
symfony ProxyAdapter ProxyAdapter ============= class **ProxyAdapter** implements [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface"), [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [ProxyTrait](../traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_reset "Symfony\Component\Cache\Traits\ProxyTrait") | | | [\_\_construct](#method___construct)(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0) | | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | | | | [commit](#method_commit)() {@inheritdoc} | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} ### \_\_construct(CacheItemPoolInterface $pool, string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | CacheItemPoolInterface | $pool | | | string | $namespace | | | int | $defaultLifetime | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} symfony PhpFilesAdapter PhpFilesAdapter ================ class **PhpFilesAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") implements [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface") Traits ------ | | | | --- | --- | | [PhpFilesTrait](../traits/phpfilestrait "Symfony\Component\Cache\Traits\PhpFilesTrait") | | | [FilesystemCommonTrait](../traits/filesystemcommontrait "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(string $namespace = '', int $defaultLifetime = 0, string $directory = null) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | from [AbstractAdapter](abstractadapter#method_createConnection "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [FilesystemCommonTrait](../traits/filesystemcommontrait#method___destruct "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | static | [throwError](#method_throwError)($type, $message, $file, $line) | from [FilesystemCommonTrait](../traits/filesystemcommontrait#method_throwError "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | static | [isSupported](#method_isSupported)() | from [PhpFilesTrait](../traits/phpfilestrait#method_isSupported "Symfony\Component\Cache\Traits\PhpFilesTrait") | | bool | [prune](#method_prune)() | from [PhpFilesTrait](../traits/phpfilestrait#method_prune "Symfony\Component\Cache\Traits\PhpFilesTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $directory | | #### Exceptions | | | | --- | --- | | [CacheException](../exception/cacheexception "Symfony\Component\Cache\Exception\CacheException") | if OPcache is not enabled | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() ### static throwError($type, $message, $file, $line) #### Parameters | | | | | --- | --- | --- | | | $type | | | | $message | | | | $file | | | | $line | | ### static isSupported() ### bool prune() #### Return Value | | | | --- | --- | | bool | | symfony SimpleCacheAdapter SimpleCacheAdapter =================== class **SimpleCacheAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") implements [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [ProxyTrait](../traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(CacheInterface $pool, string $namespace = '', int $defaultLifetime = 0) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static | [createConnection](#method_createConnection)($dsn, array $options = array()) | from [AbstractAdapter](abstractadapter#method_createConnection "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [AbstractAdapter](abstractadapter#method___destruct "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | Details ------- ### protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(CacheInterface $pool, string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | CacheInterface | $pool | | | string | $namespace | | | int | $defaultLifetime | | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static createConnection($dsn, array $options = array()) #### Parameters | | | | | --- | --- | --- | | | $dsn | | | array | $options | | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() ### prune() {@inheritdoc}
programming_docs
symfony RedisAdapter RedisAdapter ============= class **RedisAdapter** extends [AbstractAdapter](abstractadapter "Symfony\Component\Cache\Adapter\AbstractAdapter") Traits ------ | | | | --- | --- | | [RedisTrait](../traits/redistrait "Symfony\Component\Cache\Traits\RedisTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(Redis|RedisArray|RedisCluster|Client $redisClient, string $namespace = '', int $defaultLifetime = 0) | | | static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | [createSystemCache](#method_createSystemCache)(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) | from [AbstractAdapter](abstractadapter#method_createSystemCache "Symfony\Component\Cache\Adapter\AbstractAdapter") | | static Redis|Client | [createConnection](#method_createConnection)(string $dsn, array $options = array()) Creates a Redis connection using a DSN configuration. | from [RedisTrait](../traits/redistrait#method_createConnection "Symfony\Component\Cache\Traits\RedisTrait") | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | [getItem](#method_getItem)($key) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItem "Symfony\Component\Cache\Adapter\AbstractAdapter") | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | [getItems](#method_getItems)(array $keys = array()) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_getItems "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [save](#method_save)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_save "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [saveDeferred](#method_saveDeferred)(CacheItemInterface $item) {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_saveDeferred "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [commit](#method_commit)() {@inheritdoc} | from [AbstractAdapter](abstractadapter#method_commit "Symfony\Component\Cache\Adapter\AbstractAdapter") | | | [\_\_destruct](#method___destruct)() | from [AbstractAdapter](abstractadapter#method___destruct "Symfony\Component\Cache\Adapter\AbstractAdapter") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(Redis|RedisArray|RedisCluster|Client $redisClient, string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | Redis|RedisArray|RedisCluster|Client | $redisClient | The redis client | | string | $namespace | | | int | $defaultLifetime | | ### static [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $version | | | string | $directory | | | LoggerInterface | $logger | | #### Return Value | | | | --- | --- | | [AdapterInterface](adapterinterface "Symfony\Component\Cache\Adapter\AdapterInterface") | | ### static Redis|Client createConnection(string $dsn, array $options = array()) Creates a Redis connection using a DSN configuration. Example DSN: - redis://localhost - redis://example.com:1234 - redis://[email protected]/13 - redis:///var/run/redis.sock - redis://secret@/var/run/redis.sock/13 #### Parameters | | | | | --- | --- | --- | | string | $dsn | | | array | $options | See self::$defaultConnectionOptions | #### Return Value | | | | --- | --- | | Redis|Client | According to the "class" option | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | when the DSN is invalid | ### [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") getItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | #### Return Value | | | | --- | --- | | [CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem") | | ### [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] getItems(array $keys = array()) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | #### Return Value | | | | --- | --- | | [Traversable](http://php.net/Traversable)|[CacheItem](../cacheitem "Symfony\Component\Cache\CacheItem")[] | | ### save(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### saveDeferred(CacheItemInterface $item) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | CacheItemInterface | $item | | ### commit() {@inheritdoc} ### \_\_destruct() symfony NullCache NullCache ========== class **NullCache** implements CacheInterface Methods ------- | | | | | --- | --- | --- | | | [get](#method_get)($key, $default = null) {@inheritdoc} | | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | | | | [has](#method_has)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [delete](#method_delete)($key) {@inheritdoc} | | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | | Details ------- ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### has($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### delete($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | symfony PhpArrayCache PhpArrayCache ============== class **PhpArrayCache** implements CacheInterface, [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0. Warmed up items are read-only and run-time discovered items are cached using a fallback adapter. Traits ------ | | | | --- | --- | | [PhpArrayTrait](../traits/phparraytrait "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [ProxyTrait](../traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_reset "Symfony\Component\Cache\Traits\ProxyTrait") | | | [warmUp](#method_warmUp)(array $values) Store an array of cached values. | from [PhpArrayTrait](../traits/phparraytrait#method_warmUp "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [PhpArrayTrait](../traits/phparraytrait#method_clear "Symfony\Component\Cache\Traits\PhpArrayTrait") | | | [\_\_construct](#method___construct)(string $file, CacheInterface $fallbackPool) | | | static CacheInterface | [create](#method_create)($file, CacheInterface $fallbackPool) This adapter takes advantage of how PHP stores arrays in its latest versions. | | | | [get](#method_get)($key, $default = null) {@inheritdoc} | | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | | | | [has](#method_has)($key) {@inheritdoc} | | | | [delete](#method_delete)($key) {@inheritdoc} | | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} ### warmUp(array $values) Store an array of cached values. #### Parameters | | | | | --- | --- | --- | | array | $values | The cached values | ### clear() {@inheritdoc} ### \_\_construct(string $file, CacheInterface $fallbackPool) #### Parameters | | | | | --- | --- | --- | | string | $file | The PHP file were values are cached | | CacheInterface | $fallbackPool | A pool to fallback on when an item is not hit | ### static CacheInterface create($file, CacheInterface $fallbackPool) This adapter takes advantage of how PHP stores arrays in its latest versions. #### Parameters | | | | | --- | --- | --- | | | $file | | | CacheInterface | $fallbackPool | | #### Return Value | | | | --- | --- | | CacheInterface | | ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### has($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### delete($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | symfony FilesystemCache FilesystemCache ================ class **FilesystemCache** extends [AbstractCache](abstractcache "Symfony\Component\Cache\Simple\AbstractCache") implements [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface") Traits ------ | | | | --- | --- | | [FilesystemTrait](../traits/filesystemtrait "Symfony\Component\Cache\Traits\FilesystemTrait") | | | [FilesystemCommonTrait](../traits/filesystemcommontrait "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(string $namespace = '', int $defaultLifetime = 0, string $directory = null) | | | | [get](#method_get)($key, $default = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_get "Symfony\Component\Cache\Simple\AbstractCache") | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_set "Symfony\Component\Cache\Simple\AbstractCache") | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_getMultiple "Symfony\Component\Cache\Simple\AbstractCache") | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_setMultiple "Symfony\Component\Cache\Simple\AbstractCache") | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | from [AbstractCache](abstractcache#method_deleteMultiple "Symfony\Component\Cache\Simple\AbstractCache") | | static | [throwError](#method_throwError)($type, $message, $file, $line) | from [FilesystemCommonTrait](../traits/filesystemcommontrait#method_throwError "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | | [\_\_destruct](#method___destruct)() | from [FilesystemCommonTrait](../traits/filesystemcommontrait#method___destruct "Symfony\Component\Cache\Traits\FilesystemCommonTrait") | | bool | [prune](#method_prune)() | from [FilesystemTrait](../traits/filesystemtrait#method_prune "Symfony\Component\Cache\Traits\FilesystemTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | | string | $directory | | ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | ### static throwError($type, $message, $file, $line) #### Parameters | | | | | --- | --- | --- | | | $type | | | | $message | | | | $file | | | | $line | | ### \_\_destruct() ### bool prune() #### Return Value | | | | --- | --- | | bool | |
programming_docs
symfony Psr6Cache Psr6Cache ========== class **Psr6Cache** implements CacheInterface, [PruneableInterface](../pruneableinterface "Symfony\Component\Cache\PruneableInterface"), [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [ProxyTrait](../traits/proxytrait "Symfony\Component\Cache\Traits\ProxyTrait") | | Methods ------- | | | | | --- | --- | --- | | | [prune](#method_prune)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_prune "Symfony\Component\Cache\Traits\ProxyTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ProxyTrait](../traits/proxytrait#method_reset "Symfony\Component\Cache\Traits\ProxyTrait") | | | [\_\_construct](#method___construct)(CacheItemPoolInterface $pool) | | | | [get](#method_get)($key, $default = null) {@inheritdoc} | | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | | | | [delete](#method_delete)($key) {@inheritdoc} | | | | [clear](#method_clear)() {@inheritdoc} | | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | | | | [has](#method_has)($key) {@inheritdoc} | | Details ------- ### prune() {@inheritdoc} ### reset() {@inheritdoc} ### \_\_construct(CacheItemPoolInterface $pool) #### Parameters | | | | | --- | --- | --- | | CacheItemPoolInterface | $pool | | ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### delete($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | ### has($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | symfony ArrayCache ArrayCache =========== class **ArrayCache** implements CacheInterface, LoggerAwareInterface, [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [ArrayTrait](../traits/arraytrait "Symfony\Component\Cache\Traits\ArrayTrait") | | | LoggerAwareTrait | | Methods ------- | | | | | --- | --- | --- | | array | [getValues](#method_getValues)() Returns all cached values, with cache miss as null. | from [ArrayTrait](../traits/arraytrait#method_getValues "Symfony\Component\Cache\Traits\ArrayTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_hasItem "Symfony\Component\Cache\Traits\ArrayTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_clear "Symfony\Component\Cache\Traits\ArrayTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_deleteItem "Symfony\Component\Cache\Traits\ArrayTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [ArrayTrait](../traits/arraytrait#method_reset "Symfony\Component\Cache\Traits\ArrayTrait") | | | [\_\_construct](#method___construct)(int $defaultLifetime = 0, bool $storeSerialized = true) | | | | [get](#method_get)($key, $default = null) {@inheritdoc} | | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | | Details ------- ### array getValues() Returns all cached values, with cache miss as null. #### Return Value | | | | --- | --- | | array | | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### reset() {@inheritdoc} ### \_\_construct(int $defaultLifetime = 0, bool $storeSerialized = true) #### Parameters | | | | | --- | --- | --- | | int | $defaultLifetime | | | bool | $storeSerialized | Disabling serialization can lead to cache corruptions when storing mutable values but increases performance otherwise | ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | symfony RedisCache RedisCache =========== class **RedisCache** extends [AbstractCache](abstractcache "Symfony\Component\Cache\Simple\AbstractCache") Traits ------ | | | | --- | --- | | [RedisTrait](../traits/redistrait "Symfony\Component\Cache\Traits\RedisTrait") | | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(Redis|RedisArray|RedisCluster|Client $redisClient, string $namespace = '', int $defaultLifetime = 0) | | | | [get](#method_get)($key, $default = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_get "Symfony\Component\Cache\Simple\AbstractCache") | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_set "Symfony\Component\Cache\Simple\AbstractCache") | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_getMultiple "Symfony\Component\Cache\Simple\AbstractCache") | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | from [AbstractCache](abstractcache#method_setMultiple "Symfony\Component\Cache\Simple\AbstractCache") | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | from [AbstractCache](abstractcache#method_deleteMultiple "Symfony\Component\Cache\Simple\AbstractCache") | | static Redis|Client | [createConnection](#method_createConnection)(string $dsn, array $options = array()) Creates a Redis connection using a DSN configuration. | from [RedisTrait](../traits/redistrait#method_createConnection "Symfony\Component\Cache\Traits\RedisTrait") | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### \_\_construct(Redis|RedisArray|RedisCluster|Client $redisClient, string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | Redis|RedisArray|RedisCluster|Client | $redisClient | | | string | $namespace | | | int | $defaultLifetime | | ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | ### static Redis|Client createConnection(string $dsn, array $options = array()) Creates a Redis connection using a DSN configuration. Example DSN: - redis://localhost - redis://example.com:1234 - redis://[email protected]/13 - redis:///var/run/redis.sock - redis://secret@/var/run/redis.sock/13 #### Parameters | | | | | --- | --- | --- | | string | $dsn | | | array | $options | See self::$defaultConnectionOptions | #### Return Value | | | | --- | --- | | Redis|Client | According to the "class" option | #### Exceptions | | | | --- | --- | | [InvalidArgumentException](../exception/invalidargumentexception "Symfony\Component\Cache\Exception\InvalidArgumentException") | when the DSN is invalid | symfony TraceableCacheEvent TraceableCacheEvent ==================== class **TraceableCacheEvent** Properties ---------- | | | | | | --- | --- | --- | --- | | | $name | | | | | $start | | | | | $end | | | | | $result | | | | | $hits | | | | | $misses | | | symfony AbstractCache AbstractCache ============== abstract class **AbstractCache** implements CacheInterface, LoggerAwareInterface, [ResettableInterface](../resettableinterface "Symfony\Component\Cache\ResettableInterface") Traits ------ | | | | --- | --- | | [AbstractTrait](../traits/abstracttrait "Symfony\Component\Cache\Traits\AbstractTrait") | | | LoggerAwareTrait | | Properties ---------- | | | | | | --- | --- | --- | --- | | protected int|null | $maxIdLength | | from [AbstractTrait](../traits/abstracttrait#property_maxIdLength "Symfony\Component\Cache\Traits\AbstractTrait") | Methods ------- | | | | | --- | --- | --- | | array|[Traversable](http://php.net/Traversable) | [doFetch](#method_doFetch)(array $ids) Fetches several cache items. | from [AbstractTrait](../traits/abstracttrait#method_doFetch "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doHave](#method_doHave)(string $id) Confirms if the cache contains specified cache item. | from [AbstractTrait](../traits/abstracttrait#method_doHave "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doClear](#method_doClear)(string $namespace) Deletes all items in the pool. | from [AbstractTrait](../traits/abstracttrait#method_doClear "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [doDelete](#method_doDelete)(array $ids) Removes multiple items from the pool. | from [AbstractTrait](../traits/abstracttrait#method_doDelete "Symfony\Component\Cache\Traits\AbstractTrait") | | array|bool | [doSave](#method_doSave)(array $values, int $lifetime) Persists several cache items immediately. | from [AbstractTrait](../traits/abstracttrait#method_doSave "Symfony\Component\Cache\Traits\AbstractTrait") | | | [hasItem](#method_hasItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_hasItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [clear](#method_clear)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_clear "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItem](#method_deleteItem)($key) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItem "Symfony\Component\Cache\Traits\AbstractTrait") | | | [deleteItems](#method_deleteItems)(array $keys) {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_deleteItems "Symfony\Component\Cache\Traits\AbstractTrait") | | bool | [enableVersioning](#method_enableVersioning)(bool $enable = true) Enables/disables versioning of items. | from [AbstractTrait](../traits/abstracttrait#method_enableVersioning "Symfony\Component\Cache\Traits\AbstractTrait") | | | [reset](#method_reset)() {@inheritdoc} | from [AbstractTrait](../traits/abstracttrait#method_reset "Symfony\Component\Cache\Traits\AbstractTrait") | | static mixed | [unserialize](#method_unserialize)(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. | from [AbstractTrait](../traits/abstracttrait#method_unserialize "Symfony\Component\Cache\Traits\AbstractTrait") | | static | [handleUnserializeCallback](#method_handleUnserializeCallback)($class) | from [AbstractTrait](../traits/abstracttrait#method_handleUnserializeCallback "Symfony\Component\Cache\Traits\AbstractTrait") | | | [\_\_construct](#method___construct)(string $namespace = '', int $defaultLifetime = 0) | | | | [get](#method_get)($key, $default = null) {@inheritdoc} | | | | [set](#method_set)($key, $value, $ttl = null) {@inheritdoc} | | | | [getMultiple](#method_getMultiple)($keys, $default = null) {@inheritdoc} | | | | [setMultiple](#method_setMultiple)($values, $ttl = null) {@inheritdoc} | | | | [deleteMultiple](#method_deleteMultiple)($keys) {@inheritdoc} | | Details ------- ### abstract protected array|[Traversable](http://php.net/Traversable) doFetch(array $ids) Fetches several cache items. #### Parameters | | | | | --- | --- | --- | | array | $ids | The cache identifiers to fetch | #### Return Value | | | | --- | --- | | array|[Traversable](http://php.net/Traversable) | The corresponding values found in the cache | ### abstract protected bool doHave(string $id) Confirms if the cache contains specified cache item. #### Parameters | | | | | --- | --- | --- | | string | $id | The identifier for which to check existence | #### Return Value | | | | --- | --- | | bool | True if item exists in the cache, false otherwise | ### abstract protected bool doClear(string $namespace) Deletes all items in the pool. #### Parameters | | | | | --- | --- | --- | | string | $namespace | The prefix used for all identifiers managed by this pool | #### Return Value | | | | --- | --- | | bool | True if the pool was successfully cleared, false otherwise | ### abstract protected bool doDelete(array $ids) Removes multiple items from the pool. #### Parameters | | | | | --- | --- | --- | | array | $ids | An array of identifiers that should be removed from the pool | #### Return Value | | | | --- | --- | | bool | True if the items were successfully removed, false otherwise | ### abstract protected array|bool doSave(array $values, int $lifetime) Persists several cache items immediately. #### Parameters | | | | | --- | --- | --- | | array | $values | The values to cache, indexed by their cache identifier | | int | $lifetime | The lifetime of the cached values, 0 for persisting until manual cleaning | #### Return Value | | | | --- | --- | | array|bool | The identifiers that failed to be cached or a boolean stating if caching succeeded or not | ### hasItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### clear() {@inheritdoc} ### deleteItem($key) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | ### deleteItems(array $keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | array | $keys | | ### bool enableVersioning(bool $enable = true) Enables/disables versioning of items. When versioning is enabled, clearing the cache is atomic and doesn't require listing existing keys to proceed, but old keys may need garbage collection and extra round-trips to the back-end are required. Calling this method also clears the memoized namespace version and thus forces a resynchonization of it. #### Parameters | | | | | --- | --- | --- | | bool | $enable | | #### Return Value | | | | --- | --- | | bool | the previous state of versioning | ### reset() {@inheritdoc} ### static protected mixed unserialize(string $value) Like the native unserialize() function but throws an exception if anything goes wrong. #### Parameters | | | | | --- | --- | --- | | string | $value | | #### Return Value | | | | --- | --- | | mixed | | #### Exceptions | | | | --- | --- | | [Exception](http://php.net/Exception) | | ### static handleUnserializeCallback($class) #### Parameters | | | | | --- | --- | --- | | | $class | | ### protected \_\_construct(string $namespace = '', int $defaultLifetime = 0) #### Parameters | | | | | --- | --- | --- | | string | $namespace | | | int | $defaultLifetime | | ### get($key, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $default | | ### set($key, $value, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $key | | | | $value | | | | $ttl | | ### getMultiple($keys, $default = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | | | | $default | | ### setMultiple($values, $ttl = null) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $values | | | | $ttl | | ### deleteMultiple($keys) {@inheritdoc} #### Parameters | | | | | --- | --- | --- | | | $keys | |
programming_docs