symfony/symfony — Issue #2992: [RFC] Validation metadata
Author: henrikbjorn
Created: 2011-12-29 14:18:28+00:00
State: open

Currently there is three ways of defining metadata for validation. These are through Annotations, XML Files or YAML Files. Where the most flexible is Annotations because they let you define them in the file where they are needed. This is not the case for XML Files and YAML Files. They have a restriction on only **one** metadata file per bundle. This **can** be a issue if you have more than 10 entities or service objects that need validation. It is also inconsistent with Doctrine which let you define one metadata file per entity for XML and YAML.

So i would like to propose adopting @schmittjoh metadata library for handling validation metadata. This library is already used in his serializer bundle which is distributed with symfony-standard. It will let us have one metadata file per object and there for have a better file hierarchy and easier to find where different files get they validation constraints from. It will also let us merge metadata between Annotations, YAML and XML files so bundles distributors can follow the best practices of using XML and end users can choose which ever they like the best, where most will proberly use Annotations.