merged branch Tobion/formdoc (PR #5350)
Commits -------83dc966
[Form] Fixed some PHPDoc596bbb1
[Form] fixed FormConfigBuilder to use PropertyPathInterfacea523823
[Form] fixed and added phpDoc Discussion ---------- [Form] fixed and added phpDoc [ci skip] --------------------------------------------------------------------------- by sstok at 2012-08-26T08:11:01Z Some descriptions don''t seem to be properly aligned, use the CS-fixer. --------------------------------------------------------------------------- by Tobion at 2012-08-26T17:02:25Z @sstok This is more about manual fixes concerning forgotten exceptions or wrong data type. The cs fixer gives many false positives and can be applied later.
This commit is contained in:
commit
66a060defd
@ -33,9 +33,9 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
|
|||||||
/**
|
/**
|
||||||
* Construct an ORM Query Builder Loader
|
* Construct an ORM Query Builder Loader
|
||||||
*
|
*
|
||||||
* @param QueryBuilder $queryBuilder
|
* @param QueryBuilder|\Closure $queryBuilder
|
||||||
* @param EntityManager $manager
|
* @param EntityManager $manager
|
||||||
* @param string $class
|
* @param string $class
|
||||||
*/
|
*/
|
||||||
public function __construct($queryBuilder, $manager = null, $class = null)
|
public function __construct($queryBuilder, $manager = null, $class = null)
|
||||||
{
|
{
|
||||||
|
@ -155,6 +155,7 @@ abstract class DoctrineType extends AbstractType
|
|||||||
* @param ObjectManager $manager
|
* @param ObjectManager $manager
|
||||||
* @param mixed $queryBuilder
|
* @param mixed $queryBuilder
|
||||||
* @param string $class
|
* @param string $class
|
||||||
|
*
|
||||||
* @return EntityLoaderInterface
|
* @return EntityLoaderInterface
|
||||||
*/
|
*/
|
||||||
abstract public function getLoader(ObjectManager $manager, $queryBuilder, $class);
|
abstract public function getLoader(ObjectManager $manager, $queryBuilder, $class);
|
||||||
|
@ -50,7 +50,7 @@ class DataEvent extends Event
|
|||||||
/**
|
/**
|
||||||
* Returns the data associated with this event.
|
* Returns the data associated with this event.
|
||||||
*
|
*
|
||||||
* @return type
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData()
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ class DataEvent extends Event
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows updating with some filtered data
|
* Allows updating with some filtered data.
|
||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +77,9 @@ class ChoiceToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
*
|
*
|
||||||
* @return mixed A scalar value
|
* @return mixed A scalar value
|
||||||
*
|
*
|
||||||
* @throws new UnexpectedTypeException if the given value is not an array
|
* @throws UnexpectedTypeException if the given value is not an array
|
||||||
|
* @throws TransformationFailedException if the recuperation of the choices fails or
|
||||||
|
* if some choice can't be found
|
||||||
*/
|
*/
|
||||||
public function reverseTransform($values)
|
public function reverseTransform($values)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
*
|
*
|
||||||
* @return mixed An array
|
* @return mixed An array
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the given value is not an array
|
* @throws UnexpectedTypeException if the given value is not an array
|
||||||
* @throws TransformationFailedException if the choices can not be retrieved
|
* @throws TransformationFailedException if the choices can not be retrieved
|
||||||
*/
|
*/
|
||||||
public function transform($array)
|
public function transform($array)
|
||||||
@ -79,7 +79,9 @@ class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
|
|||||||
*
|
*
|
||||||
* @return mixed An array
|
* @return mixed An array
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the given value is not an array
|
* @throws UnexpectedTypeException if the given value is not an array
|
||||||
|
* @throws TransformationFailedException if the recuperation of the choices fails or
|
||||||
|
* if some choice can't be found
|
||||||
*/
|
*/
|
||||||
public function reverseTransform($values)
|
public function reverseTransform($values)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,8 @@ class ChoicesToValuesTransformer implements DataTransformerInterface
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException if the given value is not an array
|
* @throws UnexpectedTypeException if the given value is not an array
|
||||||
|
* @throws TransformationFailedException if could not find all matching choices for the given values
|
||||||
*/
|
*/
|
||||||
public function reverseTransform($array)
|
public function reverseTransform($array)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,8 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
|
|||||||
*
|
*
|
||||||
* @param integer $precision The precision
|
* @param integer $precision The precision
|
||||||
* @param string $type One of the supported types
|
* @param string $type One of the supported types
|
||||||
|
*
|
||||||
|
* @throws UnexpectedTypeException if the given value of type is unknown
|
||||||
*/
|
*/
|
||||||
public function __construct($precision = null, $type = null)
|
public function __construct($precision = null, $type = null)
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,8 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
* Creates a new form based on the given configuration.
|
* Creates a new form based on the given configuration.
|
||||||
*
|
*
|
||||||
* @param FormConfigInterface $config The form configuration.
|
* @param FormConfigInterface $config The form configuration.
|
||||||
|
*
|
||||||
|
* @throws FormException if a data mapper is not provided for a compound form
|
||||||
*/
|
*/
|
||||||
public function __construct(FormConfigInterface $config)
|
public function __construct(FormConfigInterface $config)
|
||||||
{
|
{
|
||||||
@ -164,9 +166,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configuration of the form.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return FormConfigInterface The form's configuration.
|
|
||||||
*/
|
*/
|
||||||
public function getConfig()
|
public function getConfig()
|
||||||
{
|
{
|
||||||
@ -174,9 +174,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name by which the form is identified in forms.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return string The name of the form.
|
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
@ -247,11 +245,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent form.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param FormInterface $parent The parent form
|
|
||||||
*
|
|
||||||
* @return Form The current form
|
|
||||||
*/
|
*/
|
||||||
public function setParent(FormInterface $parent = null)
|
public function setParent(FormInterface $parent = null)
|
||||||
{
|
{
|
||||||
@ -269,9 +263,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the parent form.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return FormInterface The parent form
|
|
||||||
*/
|
*/
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
@ -279,9 +271,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the form has a parent.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
*/
|
||||||
public function hasParent()
|
public function hasParent()
|
||||||
{
|
{
|
||||||
@ -289,9 +279,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root of the form tree.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return FormInterface The root of the tree
|
|
||||||
*/
|
*/
|
||||||
public function getRoot()
|
public function getRoot()
|
||||||
{
|
{
|
||||||
@ -299,9 +287,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the form is the root of the form tree.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
*/
|
||||||
public function isRoot()
|
public function isRoot()
|
||||||
{
|
{
|
||||||
@ -339,11 +325,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the form with default data.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param mixed $modelData The data formatted as expected for the underlying object
|
|
||||||
*
|
|
||||||
* @return Form The current form
|
|
||||||
*/
|
*/
|
||||||
public function setData($modelData)
|
public function setData($modelData)
|
||||||
{
|
{
|
||||||
@ -440,9 +422,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data in the format needed for the underlying object.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function getData()
|
public function getData()
|
||||||
{
|
{
|
||||||
@ -454,11 +434,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the normalized data of the form.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return mixed When the form is not bound, the default data is returned.
|
|
||||||
* When the form is bound, the normalized bound data is
|
|
||||||
* returned if the form is valid, null otherwise.
|
|
||||||
*/
|
*/
|
||||||
public function getNormData()
|
public function getNormData()
|
||||||
{
|
{
|
||||||
@ -470,9 +446,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data transformed by the value transformer.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getViewData()
|
public function getViewData()
|
||||||
{
|
{
|
||||||
@ -497,9 +471,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the extra data.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return array The bound data which do not belong to a child
|
|
||||||
*/
|
*/
|
||||||
public function getExtraData()
|
public function getExtraData()
|
||||||
{
|
{
|
||||||
@ -507,13 +479,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds data to the form, transforms and validates it.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param string|array $submittedData The data
|
|
||||||
*
|
|
||||||
* @return Form The current form
|
|
||||||
*
|
|
||||||
* @throws UnexpectedTypeException
|
|
||||||
*/
|
*/
|
||||||
public function bind($submittedData)
|
public function bind($submittedData)
|
||||||
{
|
{
|
||||||
@ -677,11 +643,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an error to this form.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param FormError $error
|
|
||||||
*
|
|
||||||
* @return Form The current form
|
|
||||||
*/
|
*/
|
||||||
public function addError(FormError $error)
|
public function addError(FormError $error)
|
||||||
{
|
{
|
||||||
@ -708,9 +670,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the form is bound.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return Boolean true if the form is bound to input values, false otherwise
|
|
||||||
*/
|
*/
|
||||||
public function isBound()
|
public function isBound()
|
||||||
{
|
{
|
||||||
@ -718,9 +678,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the data in the different formats is synchronized.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
*/
|
||||||
public function isSynchronized()
|
public function isSynchronized()
|
||||||
{
|
{
|
||||||
@ -728,9 +686,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the form is empty.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
*/
|
||||||
public function isEmpty()
|
public function isEmpty()
|
||||||
{
|
{
|
||||||
@ -744,9 +700,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the form is valid.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
*/
|
||||||
public function isValid()
|
public function isValid()
|
||||||
{
|
{
|
||||||
@ -783,9 +737,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all errors.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @return array An array of FormError instances that occurred during binding
|
|
||||||
*/
|
*/
|
||||||
public function getErrors()
|
public function getErrors()
|
||||||
{
|
{
|
||||||
@ -962,11 +914,11 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the child exists (implements the \ArrayAccess interface).
|
* Returns whether a child with the given name exists (implements the \ArrayAccess interface).
|
||||||
*
|
*
|
||||||
* @param string $name The name of the child
|
* @param string $name The name of the child
|
||||||
*
|
*
|
||||||
* @return Boolean true if the widget exists, false otherwise
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public function offsetExists($name)
|
public function offsetExists($name)
|
||||||
{
|
{
|
||||||
@ -974,11 +926,13 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the form child associated with the name (implements the \ArrayAccess interface).
|
* Returns the child with the given name (implements the \ArrayAccess interface).
|
||||||
*
|
*
|
||||||
* @param string $name The offset of the value to get
|
* @param string $name The name of the child
|
||||||
*
|
*
|
||||||
* @return FormInterface A form instance
|
* @return FormInterface The child form
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException If the named child does not exist.
|
||||||
*/
|
*/
|
||||||
public function offsetGet($name)
|
public function offsetGet($name)
|
||||||
{
|
{
|
||||||
@ -989,7 +943,12 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
* Adds a child to the form (implements the \ArrayAccess interface).
|
* Adds a child to the form (implements the \ArrayAccess interface).
|
||||||
*
|
*
|
||||||
* @param string $name Ignored. The name of the child is used.
|
* @param string $name Ignored. The name of the child is used.
|
||||||
* @param FormInterface $child The child to be added
|
* @param FormInterface $child The child to be added.
|
||||||
|
*
|
||||||
|
* @throws AlreadyBoundException If the form has already been bound.
|
||||||
|
* @throws FormException When trying to add a child to a non-compound form.
|
||||||
|
*
|
||||||
|
* @see self::add()
|
||||||
*/
|
*/
|
||||||
public function offsetSet($name, $child)
|
public function offsetSet($name, $child)
|
||||||
{
|
{
|
||||||
@ -999,7 +958,9 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
/**
|
/**
|
||||||
* Removes the child with the given name from the form (implements the \ArrayAccess interface).
|
* Removes the child with the given name from the form (implements the \ArrayAccess interface).
|
||||||
*
|
*
|
||||||
* @param string $name The name of the child to be removed
|
* @param string $name The name of the child to remove
|
||||||
|
*
|
||||||
|
* @throws AlreadyBoundException If the form has already been bound.
|
||||||
*/
|
*/
|
||||||
public function offsetUnset($name)
|
public function offsetUnset($name)
|
||||||
{
|
{
|
||||||
@ -1043,7 +1004,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $value The value to transform
|
* @param mixed $value The value to transform
|
||||||
*
|
*
|
||||||
* @return string
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function modelToNorm($value)
|
private function modelToNorm($value)
|
||||||
{
|
{
|
||||||
@ -1077,7 +1038,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $value The value to transform
|
* @param mixed $value The value to transform
|
||||||
*
|
*
|
||||||
* @return string
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function normToView($value)
|
private function normToView($value)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,8 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB
|
|||||||
private $unresolvedChildren = array();
|
private $unresolvedChildren = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The parent of this builder
|
* The parent of this builder.
|
||||||
|
*
|
||||||
* @var FormBuilder
|
* @var FormBuilder
|
||||||
*/
|
*/
|
||||||
private $parent;
|
private $parent;
|
||||||
|
@ -14,6 +14,7 @@ namespace Symfony\Component\Form;
|
|||||||
use Symfony\Component\Form\Exception\FormException;
|
use Symfony\Component\Form\Exception\FormException;
|
||||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||||
use Symfony\Component\Form\Util\PropertyPath;
|
use Symfony\Component\Form\Util\PropertyPath;
|
||||||
|
use Symfony\Component\Form\Util\PropertyPathInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
|
use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
|
||||||
@ -41,7 +42,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var PropertyPath
|
* @var PropertyPathInterface
|
||||||
*/
|
*/
|
||||||
private $propertyPath;
|
private $propertyPath;
|
||||||
|
|
||||||
@ -143,7 +144,6 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
* @param EventDispatcherInterface $dispatcher The event dispatcher
|
* @param EventDispatcherInterface $dispatcher The event dispatcher
|
||||||
* @param array $options The form options
|
* @param array $options The form options
|
||||||
*
|
*
|
||||||
* @throws UnexpectedTypeException If the name is not a string.
|
|
||||||
* @throws \InvalidArgumentException If the data class is not a valid class or if
|
* @throws \InvalidArgumentException If the data class is not a valid class or if
|
||||||
* the name contains invalid characters.
|
* the name contains invalid characters.
|
||||||
*/
|
*/
|
||||||
@ -244,6 +244,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*
|
*
|
||||||
* @return FormConfigBuilder The configuration object.
|
* @return FormConfigBuilder The configuration object.
|
||||||
*
|
*
|
||||||
|
* @throws FormException if the form configuration is locked
|
||||||
|
*
|
||||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
||||||
* {@link addViewTransformer()} instead.
|
* {@link addViewTransformer()} instead.
|
||||||
*/
|
*/
|
||||||
@ -263,6 +265,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*
|
*
|
||||||
* @return FormConfigBuilder The configuration object.
|
* @return FormConfigBuilder The configuration object.
|
||||||
*
|
*
|
||||||
|
* @throws FormException if the form configuration is locked
|
||||||
|
*
|
||||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
|
||||||
*/
|
*/
|
||||||
public function prependClientTransformer(DataTransformerInterface $viewTransformer)
|
public function prependClientTransformer(DataTransformerInterface $viewTransformer)
|
||||||
@ -279,6 +283,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*
|
*
|
||||||
* @return FormConfigBuilder The configuration object.
|
* @return FormConfigBuilder The configuration object.
|
||||||
*
|
*
|
||||||
|
* @throws FormException if the form configuration is locked
|
||||||
|
*
|
||||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
||||||
* {@link resetViewTransformers()} instead.
|
* {@link resetViewTransformers()} instead.
|
||||||
*/
|
*/
|
||||||
@ -330,6 +336,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*
|
*
|
||||||
* @return FormConfigBuilder The configuration object.
|
* @return FormConfigBuilder The configuration object.
|
||||||
*
|
*
|
||||||
|
* @throws FormException if the form configuration is locked
|
||||||
|
*
|
||||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3.
|
||||||
*/
|
*/
|
||||||
public function appendNormTransformer(DataTransformerInterface $modelTransformer)
|
public function appendNormTransformer(DataTransformerInterface $modelTransformer)
|
||||||
@ -348,6 +356,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*
|
*
|
||||||
* @return FormConfigBuilder The configuration object.
|
* @return FormConfigBuilder The configuration object.
|
||||||
*
|
*
|
||||||
|
* @throws FormException if the form configuration is locked
|
||||||
|
*
|
||||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
||||||
* {@link addModelTransformer()} instead.
|
* {@link addModelTransformer()} instead.
|
||||||
*/
|
*/
|
||||||
@ -365,6 +375,8 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
*
|
*
|
||||||
* @return FormConfigBuilder The configuration object.
|
* @return FormConfigBuilder The configuration object.
|
||||||
*
|
*
|
||||||
|
* @throws FormException if the form configuration is locked
|
||||||
|
*
|
||||||
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
|
||||||
* {@link resetModelTransformers()} instead.
|
* {@link resetModelTransformers()} instead.
|
||||||
*/
|
*/
|
||||||
@ -710,7 +722,7 @@ class FormConfigBuilder implements FormConfigBuilderInterface
|
|||||||
throw new FormException('The config builder cannot be modified anymore.');
|
throw new FormException('The config builder cannot be modified anymore.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $propertyPath && !$propertyPath instanceof PropertyPath) {
|
if (null !== $propertyPath && !$propertyPath instanceof PropertyPathInterface) {
|
||||||
$propertyPath = new PropertyPath($propertyPath);
|
$propertyPath = new PropertyPath($propertyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,9 +162,9 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
|||||||
/**
|
/**
|
||||||
* Sets the property path that the form should be mapped to.
|
* Sets the property path that the form should be mapped to.
|
||||||
*
|
*
|
||||||
* @param string|PropertyPath $propertyPath The property path or null if the path
|
* @param null|string|PropertyPathInterface $propertyPath The property path or null if the path
|
||||||
* should be set automatically based on
|
* should be set automatically based on
|
||||||
* the form's name.
|
* the form's name.
|
||||||
*
|
*
|
||||||
* @return self The configuration object.
|
* @return self The configuration object.
|
||||||
*/
|
*/
|
||||||
@ -184,7 +184,7 @@ interface FormConfigBuilderInterface extends FormConfigInterface
|
|||||||
* Sets whether the form's data should be modified by reference.
|
* Sets whether the form's data should be modified by reference.
|
||||||
*
|
*
|
||||||
* @param Boolean $byReference Whether the data should be
|
* @param Boolean $byReference Whether the data should be
|
||||||
* modified by reference.
|
* modified by reference.
|
||||||
*
|
*
|
||||||
* @return self The configuration object.
|
* @return self The configuration object.
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +35,7 @@ interface FormConfigInterface
|
|||||||
/**
|
/**
|
||||||
* Returns the property path that the form should be mapped to.
|
* Returns the property path that the form should be mapped to.
|
||||||
*
|
*
|
||||||
* @return Util\PropertyPath The property path.
|
* @return null|Util\PropertyPathInterface The property path.
|
||||||
*/
|
*/
|
||||||
public function getPropertyPath();
|
public function getPropertyPath();
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ class FormError
|
|||||||
*
|
*
|
||||||
* Any array key in $messageParameters will be used as a placeholder in
|
* Any array key in $messageParameters will be used as a placeholder in
|
||||||
* $messageTemplate.
|
* $messageTemplate.
|
||||||
* @see Symfony\Component\Translation\Translator
|
* @see \Symfony\Component\Translation\Translator
|
||||||
*
|
*
|
||||||
* @param string $messageTemplate The template for the error message
|
* @param string $messageTemplate The template for the error message
|
||||||
* @param array $messageParameters The parameters that should be
|
* @param array $messageParameters The parameters that should be
|
||||||
* substituted in the message template.
|
* substituted in the message template.
|
||||||
* @param integer $messagePluralization The value for error message pluralization
|
* @param integer|null $messagePluralization The value for error message pluralization
|
||||||
*/
|
*/
|
||||||
public function __construct($messageTemplate, array $messageParameters = array(), $messagePluralization = null)
|
public function __construct($messageTemplate, array $messageParameters = array(), $messagePluralization = null)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Form;
|
namespace Symfony\Component\Form;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A form group bundling multiple form forms
|
* A form group bundling multiple forms in a hierarchical structure.
|
||||||
*
|
*
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
@ -24,6 +24,10 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
* @param FormInterface $parent The parent form
|
* @param FormInterface $parent The parent form
|
||||||
*
|
*
|
||||||
* @return FormInterface The form instance
|
* @return FormInterface The form instance
|
||||||
|
*
|
||||||
|
* @throws Exception\AlreadyBoundException If the form has already been bound.
|
||||||
|
* @throws Exception\FormException When trying to set a parent for a form with
|
||||||
|
* an empty name.
|
||||||
*/
|
*/
|
||||||
public function setParent(FormInterface $parent = null);
|
public function setParent(FormInterface $parent = null);
|
||||||
|
|
||||||
@ -47,6 +51,9 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
* @param FormInterface $child The FormInterface to add as a child
|
* @param FormInterface $child The FormInterface to add as a child
|
||||||
*
|
*
|
||||||
* @return FormInterface The form instance
|
* @return FormInterface The form instance
|
||||||
|
*
|
||||||
|
* @throws Exception\AlreadyBoundException If the form has already been bound.
|
||||||
|
* @throws Exception\FormException When trying to add a child to a non-compound form.
|
||||||
*/
|
*/
|
||||||
public function add(FormInterface $child);
|
public function add(FormInterface $child);
|
||||||
|
|
||||||
@ -56,6 +63,8 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
* @param string $name The name of the child
|
* @param string $name The name of the child
|
||||||
*
|
*
|
||||||
* @return FormInterface The child form
|
* @return FormInterface The child form
|
||||||
|
*
|
||||||
|
* @throws \InvalidArgumentException If the named child does not exist.
|
||||||
*/
|
*/
|
||||||
public function get($name);
|
public function get($name);
|
||||||
|
|
||||||
@ -74,6 +83,8 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
* @param string $name The name of the child to remove
|
* @param string $name The name of the child to remove
|
||||||
*
|
*
|
||||||
* @return FormInterface The form instance
|
* @return FormInterface The form instance
|
||||||
|
*
|
||||||
|
* @throws Exception\AlreadyBoundException If the form has already been bound.
|
||||||
*/
|
*/
|
||||||
public function remove($name);
|
public function remove($name);
|
||||||
|
|
||||||
@ -92,11 +103,16 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
public function getErrors();
|
public function getErrors();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the field with default data.
|
* Updates the form with default data.
|
||||||
*
|
*
|
||||||
* @param array $modelData The data formatted as expected for the underlying object
|
* @param array $modelData The data formatted as expected for the underlying object
|
||||||
*
|
*
|
||||||
* @return FormInterface The form instance
|
* @return FormInterface The form instance
|
||||||
|
*
|
||||||
|
* @throws Exception\AlreadyBoundException If the form has already been bound.
|
||||||
|
* @throws Exception\FormException 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}.
|
||||||
*/
|
*/
|
||||||
public function setData($modelData);
|
public function setData($modelData);
|
||||||
|
|
||||||
@ -111,15 +127,15 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
* Returns the normalized data of the field.
|
* Returns the normalized data of the field.
|
||||||
*
|
*
|
||||||
* @return mixed When the field is not bound, the default data is returned.
|
* @return mixed When the field is not bound, the default data is returned.
|
||||||
* When the field is bound, the normalized bound data is
|
* When the field is bound, the normalized bound data is
|
||||||
* returned if the field is valid, null otherwise.
|
* returned if the field is valid, null otherwise.
|
||||||
*/
|
*/
|
||||||
public function getNormData();
|
public function getNormData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data transformed by the value transformer.
|
* Returns the data transformed by the value transformer.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getViewData();
|
public function getViewData();
|
||||||
|
|
||||||
@ -154,7 +170,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
/**
|
/**
|
||||||
* Returns the property path that the form is mapped to.
|
* Returns the property path that the form is mapped to.
|
||||||
*
|
*
|
||||||
* @return Util\PropertyPath The property path.
|
* @return Util\PropertyPathInterface The property path.
|
||||||
*/
|
*/
|
||||||
public function getPropertyPath();
|
public function getPropertyPath();
|
||||||
|
|
||||||
@ -213,13 +229,15 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
public function isSynchronized();
|
public function isSynchronized();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes data into the form.
|
* Binds data to the form, transforms and validates it.
|
||||||
*
|
*
|
||||||
* @param mixed $data The data
|
* @param null|string|array $submittedData The data
|
||||||
*
|
*
|
||||||
* @return FormInterface The form instance
|
* @return FormInterface The form instance
|
||||||
|
*
|
||||||
|
* @throws Exception\AlreadyBoundException If the form has already been bound.
|
||||||
*/
|
*/
|
||||||
public function bind($data);
|
public function bind($submittedData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root of the form tree.
|
* Returns the root of the form tree.
|
||||||
|
@ -96,6 +96,8 @@ abstract class Guess
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param integer $confidence The confidence
|
* @param integer $confidence The confidence
|
||||||
|
*
|
||||||
|
* @throws \UnexpectedValueException if the given value of confidence is unknown
|
||||||
*/
|
*/
|
||||||
public function __construct($confidence)
|
public function __construct($confidence)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +89,8 @@ class PropertyPathBuilder
|
|||||||
*
|
*
|
||||||
* @param integer $offset The offset at which to remove.
|
* @param integer $offset The offset at which to remove.
|
||||||
* @param integer $length The length of the removed piece.
|
* @param integer $length The length of the removed piece.
|
||||||
|
*
|
||||||
|
* @throws \OutOfBoundsException if offset is invalid
|
||||||
*/
|
*/
|
||||||
public function remove($offset, $length = 1)
|
public function remove($offset, $length = 1)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ class PropertyPathIterator extends \ArrayIterator implements PropertyPathIterato
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The traversed property path
|
* The traversed property path
|
||||||
* @var PropertyPath
|
* @var PropertyPathInterface
|
||||||
*/
|
*/
|
||||||
protected $path;
|
protected $path;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user