-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
There's no point in having a customizable Media entity when the createMedia method creates the entity and then immediately persist is and flushes the DB (which, by the way, is a terrible practice as it can cause unexpected flushes in the middle of a request).
For one it'd be nice if all the createFrom* methods were public for more granular control by user.
The save issue could be solved in several ways:
- Remove the save method from
createMediasince it's the programmer's responsibility to manage entities. You don't necessarily want to always immediately persist (and definitely not flush) an entity you create. This is easiest and IMO most correct but breaks BC. - Pass an argument to
createMediaon whether to save; perhaps just$flushlike you have on other methods. This is a simple solution even if it's not very neat. - Add some events to the manager logic that fire right after entity creation, right before save, etc. This would add great verstility, is still correct, and allows most customization (especially if you add events for other things too). It's however somewhat harder, though I'd suggest doing this anyway in addition to one of the above options.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels