views:

3

answers:

0

Hi all, I'd like to know what the best general approach would be for the following: I have a Showcase and a Showcase has many Image as well as Video. I would like to have those Images and Videos in one gallery, and I would like to be able to order them within that same gallery. Images and Videos (can) belong to many galleries.

I'm looking for the best approach here. What I figured out so far is the following: Use a table MediaItems that unifies and orders Images and Videos, where Showcase has many MediaItem, MediaItem habtm Video and MediaItem habtm Image. MediaItem consists of the fields id, showcase_id, image_id, video_id and order. image_id and video_id are allowed NULL.

Is this the right way to do it? I imagine I'm not the first one with this structure, is there a specific name for? So I can read in on it.

By the way: I'm working with CakePHP.

Thanks in advance!

related questions