Summary
Add native support for multi-media entity fields (array/list of media paths) in JoliMedia + EasyAdmin bridge.
Today, MediaChoiceType and Doctrine media types target a single media value. For common use cases like photo galleries, integrators must introduce an extra join entity (e.g. ServiceGalleryImage) only to store multiple media references and ordering.
Why this is needed
A lot of projects need to attach multiple images/files directly on one entity field, for example:
- service page gallery photos
- product gallery images
- project portfolio images
Current workaround:
- create a dedicated child entity (
...GalleryImage)
- manage OneToMany + ordering manually
- extra migration/model complexity for a simple list of paths
Proposal
1) Doctrine type for media lists
Add a new Doctrine type (example naming):
Types::MEDIA_JSON (or MEDIA_ARRAY)
Behavior:
- DB storage as JSON array of normalized media paths
- PHP value as
list<Media|string> or list<Media> (clear contract to define)
- path normalization on write
2) EasyAdmin form support for multi-select
Provide either:
MediaChoiceType with multiple: true, or
- a dedicated
MediaCollectionType / MediaGalleryType
Expected behavior:
- choose multiple media from library modal
- optional drag/drop ordering
- returns list compatible with new Doctrine media list type
3) Delete behavior integration
When media is deleted from the library:
- support existing delete strategies (
RESTRICT, SET_NULL) for media lists too
SET_NULL: remove matching path from the list
RESTRICT: block deletion if path exists in at least one list field
Example use case
A Service entity with:
heroImage (single media)
galleryImages (list of media paths)
In EasyAdmin, editors can add/remove/reorder gallery photos directly in one field without a dedicated join entity.
Backward compatibility
- Keep existing single-media behavior unchanged
- Introduce feature as additive (new type/new option)
Summary
Add native support for multi-media entity fields (array/list of media paths) in JoliMedia + EasyAdmin bridge.
Today,
MediaChoiceTypeand Doctrine media types target a single media value. For common use cases like photo galleries, integrators must introduce an extra join entity (e.g.ServiceGalleryImage) only to store multiple media references and ordering.Why this is needed
A lot of projects need to attach multiple images/files directly on one entity field, for example:
Current workaround:
...GalleryImage)Proposal
1) Doctrine type for media lists
Add a new Doctrine type (example naming):
Types::MEDIA_JSON(orMEDIA_ARRAY)Behavior:
list<Media|string>orlist<Media>(clear contract to define)2) EasyAdmin form support for multi-select
Provide either:
MediaChoiceTypewithmultiple: true, orMediaCollectionType/MediaGalleryTypeExpected behavior:
3) Delete behavior integration
When media is deleted from the library:
RESTRICT,SET_NULL) for media lists tooSET_NULL: remove matching path from the listRESTRICT: block deletion if path exists in at least one list fieldExample use case
A
Serviceentity with:heroImage(single media)galleryImages(list of media paths)In EasyAdmin, editors can add/remove/reorder gallery photos directly in one field without a dedicated join entity.
Backward compatibility