php - Overriding validation messages FOSUserBundle -
i overriding validation messages in entity. when got errors, validation messages displayed twice: first message fosuserbundle(login short) , second message(min 6). why?
<?php namespace acme\userbundle\entity; use fos\userbundle\model\user baseuser; use doctrine\orm\mapping orm; use symfony\component\validator\constraints assert; /** * @orm\entity * @orm\table(name="users") */ class user extends baseuser { /** * @orm\id * @orm\column(type="integer") * @orm\generatedvalue(strategy="auto") */ protected $id; /** * @assert\length(min=5, max=16, * minmessage="min 6", * maxmessage="max 16", * ) */ protected $username; //.. }
you need create own group of validators:
http://symfony.com/doc/current/book/validation.html#validation-groups
Comments
Post a Comment