propelorm/PropelBundle — pull request #68 by maxailloud (2011-11-04 11:28:22+00:00)
Title: Add a unique object constraint validator

I take for model the uniqueEntity for Doctrine to make this one.

I try to make it as generic as possible, specially for the error message.

Feel free to make feedback.

To use this uniqueObject validator you have to use it in a validation.yml file, like this:

Namespace\Model\User:
constraints:
- Propel\PropelBundle\Validator\Constraints\UniqueObject: username

For validate a association of several fields:

Namespace\Model\User:
constraints:
- Propel\PropelBundle\Validator\Constraints\UniqueObject: [username, login]

You can of course add as many validator of this type as you want.