FriendsOfSymfony/FOSUserBundle — Issue #441: MaxLength or Regex validations are ignored though MinLength works well
Author: PavelKa
Created: 2011-12-10 13:42:22+00:00
State: open

I set following annotations to define contraints, but MaxLength and Regex are ignored.
MinLength works well also if I don't define groups, but different message is always displayed if length is less then 5 (Fill value in reuired format.)
I tried to define constraints in validation.xml and validation.yml but behavior was same.
My main objective is set regular expression to specify correct format.
Any help or workaround would be appreciated as I'm close to go to production...
/**
* @ORM\Column(name="psc", type="string", length=6, nullable=false)
*
* @Assert\MinLength(
* limit=5,
* message="Length must be 5.",
* groups={"Registration", "Profile"} )
*
* @Assert\MaxLength(
* limit=5,
* message="Length must be 5.",
* groups={"Registration", "Profile"} )
*
* @Assert\Regex(
* pattern="/\d/",
* match=false,
* message="value cannot contain a number",
* groups={"Registration", "Profile"}
* )
*/
private $psc;

* @Assert\Regex(
* pattern="/\d/",
* match=false,
* message="cannot contain a number"
* )
*/
private $psc;