any solution?
On Mar 9, 3:32 pm, nhathoang nhathoang <[email protected]>
wrote:
> According to me ,your mean use hasmany to get informations of movies and
> celebrities with related cast, And you want in [Cast] =>
> [index]][celebrity_id ] to be replaced [Cast] => [index][celebrity_name],
> but in fact it can't,
>
> relationship in model has all 5 fields class name, foreign key,
> condition,field,dependent, there is not any field to concern replace name.
>
> 2009/3/9 Joe Critchley <[email protected]>
>
>
>
> > 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 <[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
-~----------~----~----~----~------~----~------~--~---