Пример #1
0
 public function savePeople()
 {
     $returnFlag = true;
     if (isset($this->_people) && is_array($this->_people)) {
         foreach ($this->_people as $newPeople) {
             $people = People::findOne(['tmdb_id' => $newPeople['tmdb_id']]);
             if (!isset($people) || empty($people)) {
                 $people = new People();
             }
             $people->tmdb_id = $newPeople['tmdb_id'];
             $people->full_name = $newPeople['full_name'];
             $people->image_path = $newPeople['image_path'];
             $people->type = $newPeople['type'];
             $returnFlag &= $people->save();
         }
     }
     return $returnFlag;
 }
Пример #2
0
 public function getPeople()
 {
     return $this->hasOne(People::className(), ['id' => 'people_id']);
 }