我有电影台& TblMovieVideos表,我有这个表的关系,所以我需要得到“YOUTUBE_ID”形式TblMovieVideos其中“预告片= 1”Yii的关系:获取数据形成另一种表
我想我需要通过此代码获得结果,但这是错误的 错误:$model->tblMovieVideos[$model->id]->trailer = 1 ->youtube_id
??????
(数据的基础图像附着)
电影型号:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'tblCinemaMovies' => array(self::HAS_MANY, 'TblCinemaMovies', 'movie_id'),
'tblDays' => array(self::HAS_MANY, 'TblDay', 'movie_id'),
'tblGenres' => array(self::HAS_MANY, 'TblGenre', 'movie_id'),
'tblMoviePhotos' => array(self::HAS_MANY, 'TblMoviePhoto', 'movie_id'),
'tblMovieVideos' => array(self::HAS_MANY, 'TblMovieVideo', 'movie_id'),
'tblShowtimes' => array(self::HAS_MANY, 'TblShowtime', 'movie_id'),
);
}
TblMoviesVideos型号:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'movie' => array(self::BELONGS_TO, 'TblMovie', 'movie_id'),
'tblSpotlights' => array(self::HAS_MANY, 'TblSpotlight', 'video_id'),
);
}
个
指标:
该表没有您正在设置的字段,因此您需要更改字段名称 – 2012-03-29 00:42:58