EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

AssociationField with autocomplete enabled does not save empty values for associations with fetch=EAGER flag

Open alshenetsky opened this issue 9 months ago • 0 comments

Describe the bug AssociationField with autocomplete enabled does not save empty values for associations with fetch=EAGER flag

To Reproduce EasyAdmin v4.24.5

  1. Create entity with some association having fetch="EAGER" flag, e.g:
    #[ManyToOne(cascade: ['persist'], fetch: 'EAGER'), JoinColumn(onDelete: 'SET NULL', nullable: true)]
    private ?Image $logo = null;
  1. Create non-required autocomplete Association field in your crud controller:
       yield AssociationField::new('logo', 'Logo')
                ->setRequired(false)
                ->autocomplete();
  1. Open an Crud::PAGE_EDIT form where the association is already filled with a non-null value.
  2. Erase value of the corresponding field and click Submit

Expected result: The corresponding field now has a value of NULL.

Observed result: The value of the corresponding field does not change.

alshenetsky avatar Apr 11 '25 12:04 alshenetsky