You mean i should write it in Movie model right?
On Mar 9, 1:20 am, James K <[email protected]> wrote: > Assuming you've properly defined all your relationships, it likely has > to do with the name of your foreign key. Cake is usually pretty good > at understanding pluralization spellings, but in this instance, it > probably just doesn't understand that celebrity_id is a foreign key > for celebrities. Specify it in your relationship definition. > > $belongsTo = array('Celebrities' => array('foreign_key' => > 'celebrity_id')) > > On Mar 8, 7:40 am, Rajesh <[email protected]> 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 [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 -~----------~----~----~----~------~----~------~--~---
