コード例 #1
0
ファイル: SkillDomainTrait.php プロジェクト: gossi/trixionary
 /**
  * Interal mechanism to add Parts to Skill
  * 
  * @param Skill $model
  * @param mixed $data
  */
 protected function doAddParts(Skill $model, $data)
 {
     $errors = [];
     foreach ($data as $entry) {
         if (!isset($entry['id'])) {
             $errors[] = 'Missing id for Skill';
         } else {
             $related = SkillQuery::create()->findOneById($entry['id']);
             $model->addSkillRelatedByPartId($related);
         }
     }
     if (count($errors) > 0) {
         return new ErrorsException($errors);
     }
 }
コード例 #2
0
ファイル: UnicyclingSample.php プロジェクト: gossi/trixionary
 public function createHoppingTree()
 {
     $root = $this->getRootSkill();
     $this->hopping = $this->createSkill(9, 'Hopping');
     $this->hopping->addSkillRelatedByParentId($root);
     $this->hoppingSIF = $this->createSkill(10, 'Hopping SIF');
     $this->hoppingSIF->addSkillRelatedByParentId($this->hopping);
     $this->unispin = $this->createSkill(11, 'Unispin');
     $this->unispin->addSkillRelatedByParentId($this->hoppingSIF);
     $this->unispin->setIsMultiple(true);
     $this->unispin180 = $this->createSkill(12, '180 Unispin');
     $this->unispin180->addSkillRelatedByParentId($this->hoppingSIF);
     $this->unispin180->setMultipleOf($this->unispin);
     $this->unispin180->setMultiplier(180);
     $this->unispin360 = $this->createSkill(13, '360 Unispin');
     $this->unispin360->addSkillRelatedByParentId($this->unispin180);
     $this->unispin360->setMultipleOf($this->unispin);
     $this->unispin360->setMultiplier(360);
     $this->rollingHop = $this->createSkill(14, 'Rolling Hop');
     $this->rollingHop->addSkillRelatedByParentId($this->hopping);
     $this->crankflips = $this->createSkill(15, 'Crankflips');
     $this->crankflips->setIsMultiple(true);
     $this->smallflip = $this->createSkill(16, 'Smallflip');
     $this->smallflip->addSkillRelatedByParentId($this->rollingHop);
     $this->smallflip->setMultipleOf($this->crankflips);
     $this->smallflip->setMultiplier(180);
     $this->crankflip = $this->createSkill(17, 'Crankflip');
     $this->crankflip->addSkillRelatedByParentId($this->rollingHop);
     $this->crankflip->setMultipleOf($this->crankflips);
     $this->crankflip->setMultiplier(360);
     $this->doubleflip = $this->createSkill(18, 'Doubleflip');
     $this->doubleflip->addSkillRelatedByParentId($this->crankflip);
     $this->doubleflip->setMultipleOf($this->crankflips);
     $this->doubleflip->setMultiplier(720);
     $this->hickflip = $this->createSkill(19, 'Hickflip');
     $this->hickflip->addSkillRelatedByParentId($this->unispin180);
     $this->hickflip->addSkillRelatedByParentId($this->crankflip);
     $this->hickflip->setIsComposite(true);
     $this->hickflip->addSkillRelatedByPartId($this->unispin180);
     $this->hickflip->addSkillRelatedByPartId($this->crankflip);
     $this->treyflip = $this->createSkill(20, 'Treyflip');
     $this->treyflip->addSkillRelatedByParentId($this->hickflip);
     $this->treyflip->addSkillRelatedByParentId($this->unispin360);
     $this->treyflip->addSkillRelatedByParentId($this->crankflip);
     $this->treyflip->setIsComposite(true);
     $this->treyflip->addSkillRelatedByPartId($this->unispin360);
     $this->treyflip->addSkillRelatedByPartId($this->crankflip);
 }