Skip to content

Difference between prePersist and preUpdate event cause validation to fail. #834

Open
@martijnhartlief

Description

@martijnhartlief

I can't explain why this happens...

When generating a new entity with a VichFile type, validation runs after the inject function, which replaces the UploadedFile with a File object. This object cannot check the mimetype, and claims the file is missing.

When you update an existing entity with a file in the VichFile type. The validation runs before the inject and uses the UploadedFile type, which causes the mimecheck to succeed.

For me there should be no difference between an existing entity or new entity since the save/validation is based on something outside the entity.

Basically how I ensured identical behavior is by removing the inject call in the upload function, but I highly doubt that's a real solution...

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions