コード例 #1
0
ファイル: Group.php プロジェクト: gossi/trixionary
 /**
  * Declares an association between this object and a ChildSport object.
  *
  * @param  ChildSport $v
  * @return $this|\gossi\trixionary\model\Group The current object (for fluent API support)
  * @throws PropelException
  */
 public function setSport(ChildSport $v = null)
 {
     if ($v === null) {
         $this->setSportId(NULL);
     } else {
         $this->setSportId($v->getId());
     }
     $this->aSport = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildSport object, it will not be re-added.
     if ($v !== null) {
         $v->addGroup($this);
     }
     return $this;
 }
コード例 #2
0
ファイル: SportDomainTrait.php プロジェクト: gossi/trixionary
 /**
  * Interal mechanism to add Groups to Sport
  * 
  * @param Sport $model
  * @param mixed $data
  */
 protected function doAddGroups(Sport $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);
     }
 }