Category: assert

Symfony – awkward Password Length violation on partial User entity update through a form containing no password field

In Symfony 5.1 project I have a form that indents to partially update User entity records (some fields except of the password and email). The form is generated with a FormBuilder class – a sub-class that extends UserType class, with…

symfony form field’s required (*) flag ignores validation groups

I’m using entity @Assert annotations with different groups tags. /** * @var string * @AssertNotBlank(groups={“basic”}) * @ORMColumn(name=”name”, type=”string”, length=255, nullable=true) */ private $name = null; /** * @var string * @AssertNotBlank(groups={“advanced”}) * @ORMColumn(name=”full_name”, type=”string”, length=255, nullable=true) */ private $fullName =…

Symfony CreateFormBuilder ignores my Entity @AssertLength

I have an entity User, which has $password with @AssertLength(min=6) /** * @var string The hashed password * @ORMColumn(type=”string”) * @AssertLength( min=6, minMessage=”Password is too short (min 6 symbols)” ) */ private $password; I’m trying to generate a Login form…

I need help writing the right constraint syntax in annotation form for validating array of objects

I’m using Symfony 5. In my app, I have a react app that posts entity data to the server. Then on the server side, I’ll json_decode the data into an object, then validate and persist it to the database. I…