示例#1
0
 /**
  * Interal mechanism to add Pictures to Skill
  * 
  * @param Skill $model
  * @param mixed $data
  */
 protected function doAddPictures(Skill $model, $data)
 {
     $errors = [];
     foreach ($data as $entry) {
         if (!isset($entry['id'])) {
             $errors[] = 'Missing id for Picture';
         } else {
             $related = PictureQuery::create()->findOneById($entry['id']);
             $model->addPicture($related);
         }
     }
     if (count($errors) > 0) {
         return new ErrorsException($errors);
     }
 }
示例#2
0
 /**
  * Declares an association between this object and a ChildSkill object.
  *
  * @param  ChildSkill $v
  * @return $this|\gossi\trixionary\model\Picture The current object (for fluent API support)
  * @throws PropelException
  */
 public function setSkill(ChildSkill $v = null)
 {
     if ($v === null) {
         $this->setSkillId(NULL);
     } else {
         $this->setSkillId($v->getId());
     }
     $this->aSkill = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildSkill object, it will not be re-added.
     if ($v !== null) {
         $v->addPicture($this);
     }
     return $this;
 }