#110068Extbase does not remove single FAL FileReference when setting property to null
Description
When using a single FAL relation in an Extbase domain model, setting the property to null and persisting the object does not remove the underlying sys_file_reference record. The relation is no longer available through Extbase after persistence, but the sys_file_reference record remains fully intact in the backend and database, including its complete file reference configuration.
$news->setImage(null);
$this->newsRepository->update($news);
$this->persistenceManager->persistAll();
Expected result
- The corresponding sys_file_reference record is removed.
- The relation is fully deleted.
Actual result
- The parent field (e.g. image) is updated and Extbase no longer returns the relation.
- The corresponding sys_file_reference record remains in the database.
- The file reference remains fully preserved in the backend and can still be found there unchanged.
- The relation is therefore only partially removed.
Comparison with ObjectStorage relations
For a multi-value FAL relation using ObjectStorage, Extbase behaves differently and removes relations correctly out of the box:
$news->removeImage($image);
$this->newsRepository->update($news);
$this->persistenceManager->persistAll();
In this case, the corresponding relation is removed as expected and no manual cleanup is required.
Workaround
The relation can be removed explicitly via:
$this->fileReferenceRepository->remove($news->getImage());
However, this should not be necessary when setting a nullable single-valued FAL relation to null.
Question
Is this intended behavior, or should Extbase remove the corresponding sys_file_reference record automatically when a single FAL relation is set to null and persisted? The current behavior appears incomplete or inconsistent, since multi-value FAL relations managed via ObjectStorage are cleaned up automatically, while equivalent single-value FAL relations are not.
Reviews 1
Related issues 2
History 3
-
Georg Ringer changed Related to #81897 <span data-processor="relativetime" data-value="2026-06-26T11:08:47+00:00" > 06/26/26, 11:08 </span>
-
Georg Ringer changed Related to #78961 <span data-processor="relativetime" data-value="2026-09-02T13:17:42+00:00" > 09/02/26, 13:17 </span>
-
Georg Ringer commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-09-02T13:18:37+00:00" > 09/02/26, 13:18 </span>
still a valid issue, but closed as duplicate of the related ones