X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fvalidator%2FContext%2FExecutionContextInterface.php;fp=vendor%2Fsymfony%2Fvalidator%2FContext%2FExecutionContextInterface.php;h=1b1452582dff454e0177cfd737a3fae7c9a6c7cc;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=d38d33747a752ac4e36df15cdd653888137bd3fd;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/symfony/validator/Context/ExecutionContextInterface.php b/vendor/symfony/validator/Context/ExecutionContextInterface.php index d38d33747..1b1452582 100644 --- a/vendor/symfony/validator/Context/ExecutionContextInterface.php +++ b/vendor/symfony/validator/Context/ExecutionContextInterface.php @@ -12,10 +12,11 @@ namespace Symfony\Component\Validator\Context; use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\ExecutionContextInterface as LegacyExecutionContextInterface; +use Symfony\Component\Validator\Mapping; use Symfony\Component\Validator\Mapping\MetadataInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; +use Symfony\Component\Validator\ConstraintViolationListInterface; /** * The context of a validation run. @@ -58,8 +59,16 @@ use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; * * @author Bernhard Schussek */ -interface ExecutionContextInterface extends LegacyExecutionContextInterface +interface ExecutionContextInterface { + /** + * Adds a violation at the current node of the validation graph. + * + * @param string $message The error message + * @param array $params The parameters substituted in the error message + */ + public function addViolation($message, array $params = array()); + /** * Returns a builder for adding a violation with extended information. * @@ -222,4 +231,114 @@ interface ExecutionContextInterface extends LegacyExecutionContextInterface * @see ObjectInitializerInterface */ public function isObjectInitialized($cacheKey); + + /** + * Returns the violations generated by the validator so far. + * + * @return ConstraintViolationListInterface The constraint violation list + */ + public function getViolations(); + + /** + * 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 mixed The root value of the validation + */ + public function getRoot(); + + /** + * 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 mixed The currently validated value + */ + public function getValue(); + + /** + * 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 MetadataInterface|null The metadata of the currently validated + * value. + */ + public function getMetadata(); + + /** + * Returns the validation group that is currently being validated. + * + * @return string The current validation group + */ + public function getGroup(); + + /** + * 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 string|null The class name or null, if no class name could be found + */ + public function getClassName(); + + /** + * 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 string|null The property name or null, if no property name could be found + */ + public function getPropertyName(); + + /** + * 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". + * + * @param string $subPath Optional. The suffix appended to the current + * property path. + * + * @return 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. + */ + public function getPropertyPath($subPath = ''); }