Open
Description
I've found interesting edge case: create form with vich file type (allow delete = true), then check remove file and submit invalid form. Post submit listener removes file from disk and clean file information from entity. But usually nobody calls flush
for invalid forms. So we got unsynchronized state: file was removed but database not updated.
I see 2 different approaches to fixing this issue:
- a. change priority of our removing listener and check for
isValid
first (easy but not cover all cases) - b. add dynamic preflush listener to entity manager wich will remove file