Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Component\Validator\Mapping;
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Stores all metadata needed for validating objects of specific class.
|
Chris@0
|
16 *
|
Chris@0
|
17 * Most importantly, the metadata stores the constraints against which an object
|
Chris@0
|
18 * and its properties should be validated.
|
Chris@0
|
19 *
|
Chris@0
|
20 * Additionally, the metadata stores whether the "Default" group is overridden
|
Chris@0
|
21 * by a group sequence for that class and whether instances of that class
|
Chris@0
|
22 * should be traversed or not.
|
Chris@0
|
23 *
|
Chris@0
|
24 * @author Bernhard Schussek <bschussek@gmail.com>
|
Chris@0
|
25 *
|
Chris@0
|
26 * @see MetadataInterface
|
Chris@0
|
27 * @see \Symfony\Component\Validator\Constraints\GroupSequence
|
Chris@0
|
28 * @see \Symfony\Component\Validator\GroupSequenceProviderInterface
|
Chris@0
|
29 * @see TraversalStrategy
|
Chris@0
|
30 */
|
Chris@0
|
31 interface ClassMetadataInterface extends MetadataInterface
|
Chris@0
|
32 {
|
Chris@0
|
33 /**
|
Chris@0
|
34 * Returns the names of all constrained properties.
|
Chris@0
|
35 *
|
Chris@0
|
36 * @return string[] A list of property names
|
Chris@0
|
37 */
|
Chris@0
|
38 public function getConstrainedProperties();
|
Chris@0
|
39
|
Chris@0
|
40 /**
|
Chris@0
|
41 * Returns whether the "Default" group is overridden by a group sequence.
|
Chris@0
|
42 *
|
Chris@0
|
43 * If it is, you can access the group sequence with {@link getGroupSequence()}.
|
Chris@0
|
44 *
|
Chris@0
|
45 * @return bool Returns true if the "Default" group is overridden
|
Chris@0
|
46 *
|
Chris@0
|
47 * @see \Symfony\Component\Validator\Constraints\GroupSequence
|
Chris@0
|
48 */
|
Chris@0
|
49 public function hasGroupSequence();
|
Chris@0
|
50
|
Chris@0
|
51 /**
|
Chris@0
|
52 * Returns the group sequence that overrides the "Default" group for this
|
Chris@0
|
53 * class.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @return \Symfony\Component\Validator\Constraints\GroupSequence|null The group sequence or null
|
Chris@0
|
56 *
|
Chris@0
|
57 * @see \Symfony\Component\Validator\Constraints\GroupSequence
|
Chris@0
|
58 */
|
Chris@0
|
59 public function getGroupSequence();
|
Chris@0
|
60
|
Chris@0
|
61 /**
|
Chris@0
|
62 * Returns whether the "Default" group is overridden by a dynamic group
|
Chris@0
|
63 * sequence obtained by the validated objects.
|
Chris@0
|
64 *
|
Chris@0
|
65 * If this method returns true, the class must implement
|
Chris@0
|
66 * {@link \Symfony\Component\Validator\GroupSequenceProviderInterface}.
|
Chris@0
|
67 * This interface will be used to obtain the group sequence when an object
|
Chris@0
|
68 * of this class is validated.
|
Chris@0
|
69 *
|
Chris@0
|
70 * @return bool Returns true if the "Default" group is overridden by
|
Chris@0
|
71 * a dynamic group sequence
|
Chris@0
|
72 *
|
Chris@0
|
73 * @see \Symfony\Component\Validator\GroupSequenceProviderInterface
|
Chris@0
|
74 */
|
Chris@0
|
75 public function isGroupSequenceProvider();
|
Chris@0
|
76
|
Chris@0
|
77 /**
|
Chris@0
|
78 * Check if there's any metadata attached to the given named property.
|
Chris@0
|
79 *
|
Chris@0
|
80 * @param string $property The property name
|
Chris@0
|
81 *
|
Chris@0
|
82 * @return bool
|
Chris@0
|
83 */
|
Chris@0
|
84 public function hasPropertyMetadata($property);
|
Chris@0
|
85
|
Chris@0
|
86 /**
|
Chris@0
|
87 * Returns all metadata instances for the given named property.
|
Chris@0
|
88 *
|
Chris@18
|
89 * If your implementation does not support properties, throw an exception
|
Chris@18
|
90 * in this method (for example a <tt>BadMethodCallException</tt>).
|
Chris@0
|
91 *
|
Chris@0
|
92 * @param string $property The property name
|
Chris@0
|
93 *
|
Chris@0
|
94 * @return PropertyMetadataInterface[] A list of metadata instances. Empty if
|
Chris@0
|
95 * no metadata exists for the property.
|
Chris@0
|
96 */
|
Chris@0
|
97 public function getPropertyMetadata($property);
|
Chris@0
|
98
|
Chris@0
|
99 /**
|
Chris@0
|
100 * Returns the name of the backing PHP class.
|
Chris@0
|
101 *
|
Chris@0
|
102 * @return string The name of the backing class
|
Chris@0
|
103 */
|
Chris@0
|
104 public function getClassName();
|
Chris@0
|
105 }
|