EasyAdminBundle
EasyAdminBundle copied to clipboard
Toggle switch on/off not working on no-persisted fields
EA 4.9.4, Symfony 6.4
Since EA 4.9.4, Toggle switch on/off not working on no-persisted fields
Getter and setter on the non persisted field are present in the entity.
I explicitely reference it as boolean in the CrudController : BooleanField::new('notDeleted', 'Active');
Toggle switch raise exception The field xxx is not allowed to be modified
https://github.com/EasyCorp/EasyAdminBundle/commit/b90a94cabe4992e6c03ad48dc4072343abdfb82b
Method ajaxEdit()
from AbstractCrudController.php
call $field = $entityDto->getFields()->getByProperty($propertyName);
witch return null on a non persisted field.
$field = $entityDto->getFields()->getByProperty($propertyName);
if (null === $field || true === $field->getFormTypeOption('disabled')) {
throw new AccessDeniedException(sprintf('The field "%s" is not allowed to be modified.', $propertyName));
}
With throw exception commented, all work fine : Toggle button works and new value is set in database thank to the setter.
Thank's