I'd go HABTM for this, I think.

movies
videos
images
images_movies
images_videos

On Tue, Mar 31, 2009 at 2:09 AM, Adam M <[email protected]> wrote:
>
> Hi All,
>
> How can I PROPERLY set up my database so that several models have
> multiple images?  Each image belongs to a particular model, so they
> are definitely hasMany relationships.  Example:
>
> Episode
> -id
> -name
> -date
>
> Movie
> -id
> -name
> -date
> -producer
>
> Image
> -id
> -name
> -caption
> -path
>
> Episode hasMany Image
> Movie hasMany Image
>
> Does the paradigm of adding a foreign key to the Image table still
> apply if I have multiple hasMany relationships?  That is, would I add
> multiple foreign keys to the table as follows?:
> Image
> -id
> -movie_id
> -episode_id
> -name
> -caption
> -path
>
> Thanks
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to