예제 #1
0
 /**
  * @param  AbstractModel           $model
  * @return Models                  $this
  * @throws InvalidArgumentExtepion If $model not part of the repo
  */
 public function add(AbstractModel $model)
 {
     if (!$this->repo->isModel($model)) {
         throw new InvalidArgumentException(sprintf('Model must be part of repo %s', $this->repo->getName()));
     }
     return parent::add($model);
 }
예제 #2
0
 /**
  * @covers ::has
  */
 public function testHas()
 {
     $model = new Model();
     $models = new Models();
     $this->assertFalse($models->has($model));
     $models->add($model);
     $this->assertTrue($models->has($model));
 }
예제 #3
0
파일: Save.php 프로젝트: harp-orm/core
 /**
  * Add only one model without traversing the linked models
  *
  * @param  AbstractModel $model
  * @return Save          $this
  */
 public function addShallow(AbstractModel $model)
 {
     $this->models->add($model);
     return $this;
 }
예제 #4
0
파일: LinkMany.php 프로젝트: harp-orm/core
 /**
  * @param  AbstractModel $model
  * @return LinkMany      $this
  */
 public function add(AbstractModel $model)
 {
     $this->current->add($model);
     return $this;
 }