Category: validation

Symfony : embeded subform and createdAt / updatedAt : validation conflict

I have an entity form that embed a collectionType and subforms. In order to make the required option work, I had to enable Auto_mapping class ClassePriceType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add(‘priceform’, PriceformType::class, […

Entity with DateTime won’t validate (no Form) [duplicate]

I have an Entity with the following annotations /** * @ORMColumn(type=”utcdatetime”) * @AssertDateTime() * @var DateTime */ private $approvedDate; The constructor in the entity sets the value as a DateTime object: public function __construct() { $utcTZ = new DateTimeZone(‘UTC’); $this->approvedDate…

Symfony 5 Constraint Validation : Customize error message

I want to use the new NotCompromisedPassword released on SF 4.3 : https://symfony.com/blog/new-in-symfony-4-3-compromised-password-validator I’ve set it up on my validation.yaml like this : AppEntityUser: constraints: – AppValidatorConstraintsConstraintPassword: ~ properties: plainPassword: – SymfonyComponentValidatorConstraintsNotCompromisedPassword: ~ It works, but i want to customize…

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 =…