示例#1
0
文件: Movie.php 项目: unused/yii-lmdb
 public function callback()
 {
     if (!$this->id) {
         throw new Exception('Movie does not exists yet');
     }
     if ($this->callback_at) {
         throw new Exception('Movie callback already executed');
     }
     $arr_infos = Callback::decode(Callback::getMovieInfo($this->tmdb_id));
     $arr_infos = array_shift($arr_infos);
     $this->addMovieImages(array_merge($arr_infos['posters'], $arr_infos['backdrops']));
     unset($arr_infos['posters']);
     unset($arr_infos['backdrops']);
     $this->addMovieAttributes($arr_infos);
     $this->callback_at = time();
     $this->save();
     $this->getRelated('attributes', true);
     $this->getRelated('images', true);
 }