Beispiel #1
0
 /**
  * Interal mechanism to add Skills to Sport
  * 
  * @param Sport $model
  * @param mixed $data
  */
 protected function doAddSkills(Sport $model, $data)
 {
     $errors = [];
     foreach ($data as $entry) {
         if (!isset($entry['id'])) {
             $errors[] = 'Missing id for Skill';
         } else {
             $related = SkillQuery::create()->findOneById($entry['id']);
             $model->addSkill($related);
         }
     }
     if (count($errors) > 0) {
         return new ErrorsException($errors);
     }
 }