我有電影臺& 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