EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

renderAsEmbeddedForm is not validating subfields in PROD mode but does in dev mode

Open Geolim4 opened this issue 1 year ago • 3 comments

Describe the bug I can't explain why but when a AssociationField that has been rendered using renderAsEmbeddedForm the required field from the form are not shown in PROD environment, but are shown in DEV environment:

PROD mode (no required fields): image

DEV mode (fields are required): image

As you can see, my code is not that exotic: image

Any idea about this, cab you reproduce it ?

Geolim4 avatar Mar 25 '24 03:03 Geolim4

Okay, I understood:

For some reason EA is not reading (or ignoring) Doctrine "nullable" flag while in prod mode. Required must be explicit + enforced with Symfony constraints.

That's... Weird ?...

Geolim4 avatar Mar 25 '24 03:03 Geolim4

I have the same issue and cannot fix it. The way with explicit required = true and constraints doesn't work for me

vladchepel avatar Apr 07 '24 15:04 vladchepel

I have the same issue and cannot fix it. The way with explicit required = true and constraints doesn't work for me

Add a #[Assert\Valid] constrait on your OneToMany association :)

Geolim4 avatar Apr 08 '24 06:04 Geolim4