File tree 3 files changed +61
-5
lines changed
src/Symfony/Component/Validator
3 files changed +61
-5
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Validator \Mapping ;
13
13
14
14
/**
15
- * @since %%NextVersion%%
15
+ * Specifies whether an object should be cascaded.
16
+ *
17
+ * Cascading is relevant for any node type but class nodes. If such a node
18
+ * contains an object of value, and if cascading is enabled, then the node
19
+ * traverser will try to find class metadata for that object and validate the
20
+ * object against that metadata.
21
+ *
22
+ * If no metadata is found for a cascaded object, and if that object implements
23
+ * {@link \Traversable}, the node traverser will iterate over the object and
24
+ * cascade each object or collection contained within, unless iteration is
25
+ * prohibited by the specified {@link TraversalStrategy}.
26
+ *
27
+ * Although the constants currently represent a boolean switch, they are
28
+ * implemented as bit mask in order to allow future extensions.
29
+ *
30
+ * @since 2.5
16
31
* @author Bernhard Schussek <bschussek@gmail.com>
32
+ *
33
+ * @see TraversalStrategy
17
34
*/
18
35
class CascadingStrategy
19
36
{
20
- const NONE = 0 ;
37
+ /**
38
+ * Specifies that a node should not be cascaded.
39
+ */
40
+ const NONE = 1 ;
21
41
22
- const CASCADE = 1 ;
42
+ /**
43
+ * Specifies that a node should be cascaded.
44
+ */
45
+ const CASCADE = 2 ;
23
46
47
+ /**
48
+ * Not instantiable.
49
+ */
24
50
private function __construct ()
25
51
{
26
52
}
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Validator \Mapping ;
13
13
14
14
/**
15
- * @since %%NextVersion%%
15
+ * Specifies whether and how a traversable object should be traversed.
16
+ *
17
+ * If the node traverser traverses a node whose value is an instance of
18
+ * {@link \Traversable}, and if that node is either a class node or if
19
+ * cascading is enabled, then the node's traversal strategy will be checked.
20
+ * Depending on the requested traversal strategy, the node traverser will
21
+ * iterate over the object and cascade each object or collection returned by
22
+ * the iterator.
23
+ *
24
+ * The traversal strategy is ignored for arrays. Arrays are always iterated.
25
+ *
26
+ * @since 2.1
16
27
* @author Bernhard Schussek <bschussek@gmail.com>
28
+ *
29
+ * @see CascadingStrategy
17
30
*/
18
31
class TraversalStrategy
19
32
{
20
33
/**
21
- * @var integer
34
+ * Specifies that a node's value should be iterated only if it is an
35
+ * instance of {@link \Traversable}.
22
36
*/
23
37
const IMPLICIT = 1 ;
24
38
39
+ /**
40
+ * Specifies that a node's value should never be iterated.
41
+ */
25
42
const NONE = 2 ;
26
43
44
+ /**
45
+ * Specifies that a node's value should always be iterated. If the value is
46
+ * not an instance of {@link \Traversable}, an exception should be thrown.
47
+ */
27
48
const TRAVERSE = 4 ;
28
49
50
+ /**
51
+ * Specifies that nested instances of {@link \Traversable} should never be
52
+ * iterated. Can be combined with {@link IMPLICIT} or {@link TRAVERSE}.
53
+ */
29
54
const STOP_RECURSION = 8 ;
30
55
56
+ /**
57
+ * Not instantiable.
58
+ */
31
59
private function __construct ()
32
60
{
33
61
}
Original file line number Diff line number Diff line change 55
55
* @author Bernhard Schussek <bschussek@gmail.com>
56
56
*
57
57
* @see NodeTraverserInterface
58
+ * @see CascadingStrategy
59
+ * @see TraversalStrategy
58
60
*/
59
61
class NonRecursiveNodeTraverser implements NodeTraverserInterface
60
62
{
You can’t perform that action at this time.
0 commit comments