Beispiel #1
0
 /**
  * Interal mechanism to add Groups to Skill
  * 
  * @param Skill $model
  * @param mixed $data
  */
 protected function doAddGroups(Skill $model, $data)
 {
     $errors = [];
     foreach ($data as $entry) {
         if (!isset($entry['id'])) {
             $errors[] = 'Missing id for Group';
         } else {
             $related = GroupQuery::create()->findOneById($entry['id']);
             $model->addGroup($related);
         }
     }
     if (count($errors) > 0) {
         return new ErrorsException($errors);
     }
 }
Beispiel #2
0
 /**
  * @return Skill
  */
 public function createSkill($id, $name)
 {
     $skill = new Skill();
     $skill->addGroup($this->group);
     $skill->setStartPosition($this->startPosition);
     $skill->setEndPosition($this->endPosition);
     $skill->setId($id);
     $skill->setName($name);
     return $skill;
 }