and many episodes.
Adam - is that the case? Or can an image only belong to either 1 movie
or 1 episode? From the description you put up it sounds like hasMany
is the right association, it's just making a good db design underneath
it.
On Mar 31, 9:39 am, brian <bally.z...@gmail.com> wrote:
> 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 <adam.mcnam...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment