Symfony\Component\Validator\MetadataInterface
A container for validation metadata.
The container contains constraints that may belong to different validation
groups. Constraints for a specific group can be fetched by calling
.
Implement this interface to add validation metadata to your own metadata
layer. Each metadata may have named properties. Each property can be
represented by one or more instances that
are returned by . Since
<tt>PropertyMetadataInterface</tt> inherits from <tt>MetadataInterface</tt>,
each property may be divided into further properties.
The method of each metadata implements the Visitor pattern.
The method should forward the call to the visitor's
method and additionally call
<tt>accept()</tt> on all structurally related metadata instances.
For example, to store constraints for PHP classes and their properties,
create a class <tt>ClassMetadata</tt> (implementing <tt>MetadataInterface</tt>)
and a class <tt>PropertyMetadata</tt> (implementing <tt>PropertyMetadataInterface</tt>).
<tt>ClassMetadata::getPropertyMetadata($property)</tt> returns all
<tt>PropertyMetadata</tt> instances for a property of that class. Its
<tt>accept()</tt>-method simply forwards to <tt>ValidationVisitorInterface::visit()</tt>
and calls <tt>accept()</tt> on all contained <tt>PropertyMetadata</tt>
instances, which themselves call <tt>ValidationVisitorInterface::visit()</tt>
again.
- Author: Bernhard Schussek <bschussek@gmail.com>
Synopsis
Hierarchy
Extended by
Implemented by
Methods
public
- accept() — Implementation of the Visitor design pattern.
- findConstraints() — Returns all constraints for a given validation group.