vendredi 25 mars 2016

implement symfony/contrainst/validation as assert in larave/doctrine

For a new project, I am using Laravel/Doctrine.

All works well, I implement the Auth Services too.

I use symfony a lot, so I was wondering if there is a way to implement the Symfony validations constraints for doctrine in laravel, or anything else like this symfony component in Laravel.

In order to use in my doctrine entities like this:

use Symfony\Component\Validator\Constraints as Assert;

class Test
{
    /**
     * @Assert\Email(
     *     message = "The email '{{ value }}' is not a valid email.",
     *     checkMX = true
     * )
     */
     protected $email;
}

If someone have already tried to do that, is there a way to show me how to make this in the good practices.

Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire