Пример #1
0
 /**
  * Interal mechanism to add Objects to Sport
  * 
  * @param Sport $model
  * @param mixed $data
  */
 protected function doAddObjects(Sport $model, $data)
 {
     $errors = [];
     foreach ($data as $entry) {
         if (!isset($entry['id'])) {
             $errors[] = 'Missing id for Object';
         } else {
             $related = ObjectQuery::create()->findOneById($entry['id']);
             $model->addObject($related);
         }
     }
     if (count($errors) > 0) {
         return new ErrorsException($errors);
     }
 }
Пример #2
0
 /**
  * Declares an association between this object and a ChildSport object.
  *
  * @param  ChildSport $v
  * @return $this|\gossi\trixionary\model\Object 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->addObject($this);
     }
     return $this;
 }