コード例 #1
0
 /**
  * Interal mechanism to add Videos to Reference
  * 
  * @param Reference $model
  * @param mixed $data
  */
 protected function doAddVideos(Reference $model, $data)
 {
     $errors = [];
     foreach ($data as $entry) {
         if (!isset($entry['id'])) {
             $errors[] = 'Missing id for Video';
         } else {
             $related = VideoQuery::create()->findOneById($entry['id']);
             $model->addVideo($related);
         }
     }
     if (count($errors) > 0) {
         return new ErrorsException($errors);
     }
 }
コード例 #2
0
ファイル: Video.php プロジェクト: gossi/trixionary
 /**
  * Declares an association between this object and a ChildReference object.
  *
  * @param  ChildReference $v
  * @return $this|\gossi\trixionary\model\Video The current object (for fluent API support)
  * @throws PropelException
  */
 public function setReference(ChildReference $v = null)
 {
     if ($v === null) {
         $this->setReferenceId(NULL);
     } else {
         $this->setReferenceId($v->getId());
     }
     $this->aReference = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildReference object, it will not be re-added.
     if ($v !== null) {
         $v->addVideo($this);
     }
     return $this;
 }