Skip to content

Discussion: directly set object property is probably not a good idea #3

@patrickli

Description

@patrickli

While easy and working, I don't like the idea that this bundle sets the vich uploader path included filename back to the object itself. Because if the entity manager is flushed after serialization, it will save the path-prepended file field into the db.

A better way is to ignore both the filename and file object fields, then use the addData() method on post-serialize to add the fully qualified file path to the serialized result. However this requires the user to manually mark the fields as excluded and only works for json since addData() is only available for json type.

Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions