Would it not be better to structure it through a HABTM relationship, using "Cast" as your 'with' model?
So, Movie HABTM Celebrity through Cast. and Celebrity HABTM Movie through Cast. On Mar 8, 12:40 pm, Rajesh <rajesh.mukk...@gmail.com> wrote: > I am working on movie site. Client have movie records in following > structure. > > CREATE TABLE IF NOT EXISTS `movies` ( > `id` int(50) NOT NULL AUTO_INCREMENT, > `movieName` varchar(500) NOT NULL, > `year` int(11) DEFAULT NULL, > PRIMARY KEY (`id`) > ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; > -- -------------------------------------------------------- > CREATE TABLE IF NOT EXISTS `celebrities` ( > `id` int(11) NOT NULL AUTO_INCREMENT, > `name` varchar(250) NOT NULL, > PRIMARY KEY (`id`) > ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; > -- -------------------------------------------------------- > CREATE TABLE IF NOT EXISTS `casts` ( > `movie_id` int(50) NOT NULL, > `role` varchar(200) DEFAULT NULL, > `celebrity_id` int(11) NOT NULL DEFAULT '0', > KEY `movieid` (`movie_id`) > ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; > > As you can see movies has casts, casts table contains movie_id and > celebrity_id. celebrities master table is for storing all master > celebrity names. > > Now my problem is i have created models for movie and celebrity like > movie hasmany cast. In movie page aim getting movie details along > related casts. But celebrity_is is showing id instead of name.... how > can i get celebrity name instead of id. Please help me. --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---