-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for annotation based validations for entities #55
Comments
The validation is done by the Validation framework. Nothing to do with this bundle. |
So how we must use it ? is there some docs ? |
Thanks, i saw that my group validator was not the good one, now it works. But i got error on UniqueValidator, how to impletment unique to work with admin ? |
@AHWEBDEV, i have the same problem with unique validation.. had you found any answer? |
@p-shad you must use the annotation on the class annotation it self An example, i use it to force my "page" entity to be unique based on the slug property. use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
/**
* @ORM\Table(name="pages")
* @ORM\Entity
* @DoctrineAssert\UniqueEntity(fields="slug", message="A page with same slug already exists", groups={"admin"})
*/
class Pages
{
[...]
} Also when you valid the entity, via a form validator or entity validator, you must specify the group of validation. This doc can be useful. http://symfony.com/doc/current/reference/constraints/UniqueEntity.html |
@AHWEBDEV ,thanks!that works! i think that we should define validation group.. |
…ation_fix Loading information message fix
two_step_code fatal error fix
I have validation rules in annotations like @Validation:MinLength(3), but BaseApplication forms don't handle them at all. It's extremaly useful to use this way of validation.
The text was updated successfully, but these errors were encountered: