Permalink
Browse files

Merge pull request #182 from zergu/patch-1

Update cookbook/symfony2/mastering-symfony2-forms-with-propel.markdown
  • Loading branch information...
2 parents 4feee47 + fa8cb29 commit ac6fc95253a9b3e3f9c018d45fe873b5243c796c @willdurand willdurand committed Nov 21, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 cookbook/symfony2/mastering-symfony2-forms-with-propel.markdown
@@ -500,15 +500,18 @@ To use it is in a `validation.yml` file just add those few lines in your validat
{% highlight yaml %}
BundleNamespace\Model\User:
constraints:
- - Propel\PropelBundle\Validator\Constraints\UniqueObject: username
+ - Propel\PropelBundle\Validator\Constraints\UniqueObject:
+ fields: username
+ message: User already exists ({{ fields }}).
{% endhighlight %}
In order to validate the unicity of more than just one fields:
{% highlight yaml %}
BundleNamespace\Model\User:
constraints:
- - Propel\PropelBundle\Validator\Constraints\UniqueObject: [username, login]
+ - Propel\PropelBundle\Validator\Constraints\UniqueObject:
+ fields: [username, login]
{% endhighlight %}
As many validator of this type as you want can be used.

0 comments on commit ac6fc95

Please sign in to comment.