[Validator] Improved inline documentation of CascadingStrategy and TraversalStrategy
This commit is contained in:
parent
524a9538bc
commit
9ca61df923
|
@ -12,15 +12,41 @@
|
|||
namespace Symfony\Component\Validator\Mapping;
|
||||
|
||||
/**
|
||||
* @since %%NextVersion%%
|
||||
* 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.
|
||||
*
|
||||
* @since 2.5
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see TraversalStrategy
|
||||
*/
|
||||
class CascadingStrategy
|
||||
{
|
||||
const NONE = 0;
|
||||
/**
|
||||
* Specifies that a node should not be cascaded.
|
||||
*/
|
||||
const NONE = 1;
|
||||
|
||||
const CASCADE = 1;
|
||||
/**
|
||||
* Specifies that a node should be cascaded.
|
||||
*/
|
||||
const CASCADE = 2;
|
||||
|
||||
/**
|
||||
* Not instantiable.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -12,22 +12,50 @@
|
|||
namespace Symfony\Component\Validator\Mapping;
|
||||
|
||||
/**
|
||||
* @since %%NextVersion%%
|
||||
* 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.
|
||||
*
|
||||
* @since 2.1
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see CascadingStrategy
|
||||
*/
|
||||
class TraversalStrategy
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
* Specifies that a node's value should be iterated only if it is an
|
||||
* instance of {@link \Traversable}.
|
||||
*/
|
||||
const IMPLICIT = 1;
|
||||
|
||||
/**
|
||||
* Specifies that a node's value should never be iterated.
|
||||
*/
|
||||
const NONE = 2;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
const TRAVERSE = 4;
|
||||
|
||||
/**
|
||||
* Specifies that nested instances of {@link \Traversable} should never be
|
||||
* iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}.
|
||||
*/
|
||||
const STOP_RECURSION = 8;
|
||||
|
||||
/**
|
||||
* Not instantiable.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -55,6 +55,8 @@ use Symfony\Component\Validator\NodeVisitor\NodeVisitorInterface;
|
|||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @see NodeTraverserInterface
|
||||
* @see CascadingStrategy
|
||||
* @see TraversalStrategy
|
||||
*/
|
||||
class NonRecursiveNodeTraverser implements NodeTraverserInterface
|
||||
{
|
||||
|
|
Reference in New Issue