Best way to set up this Relation
Hey everybody. I am looking for some advice here. I got the following tables in my application: Movies and Celebrities. Celebrities can participate in movies as Actors, Directors and Script Writters. So, while editing a movie (or adding one) I should be able in my view to select in 3 different fields the Celebrities that take role in each part. I read that in these situations I should not use HABTM relations as it won't set the parameter that will allow me to differentiate Actors from Directors. So I would need to create a model for the relationship table and set HasMany relations instead. Does that sound correct? Also, if I'm creating a Model for this relation, how would my Movies Controller and View be set up? Thanks a lot in advance! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Best way to set up this Relation
Hi Fernando, an idea that it's up to you to try is implement a MovieParticipation Model. Thus: *Celebrities* *hasMany* *MovieParticipation* *Movies* *hasMany* *MovieParticipation* * * Where the MovieParticipation table might have following fields: - *id* - *celebrity_id* - *movie_id* - *as_actor* - *as_director* - *as_scriptwritter* Where these as_{participation} fields are just flags (on-off). Since in Hollywood there are some cases where the Director is an Actor too in his movie, this way could allow you to handle them by having more than one of these flags on. Also, in this way, I think you won't be needing Actors, Directors and ScriptWritters Models and Controllers as separate stuff, just Celebrities. Now that will depend on the other features and how the whole app is expected to work. Regards, Ciul -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.