I am using EasyAdmin4 in my project.
What I want to achieve is my associated field should be disabled only on edit and only if it is not null.
I could disable it in the configuration:
public function configureFields(string $pageName): iterable
{
$fields = parent::configureFields($pageName);
$learningPathField = AssociationField::new('LearningPath');
if ($pageName === Action::NEW) {
$learningPathField->setHelp('Warning! Once you set this, you can not change when you edit Learning Path!');
}
if ($pageName === Action::EDIT) {
$learningPathField->setDisabled(true);
}
$fields[] = $learningPathField;
return $fields;
}
But I'd like to set $learningPathField->setDisabled(true); only its value is not null.
How can I get the value of this field?