Ouzo\Db\BatchInserter::add PHP Метод

add() публичный Метод

public add ( Model $model )
$model Ouzo\Model
    public function add(Model $model)
    {
        $this->_models[] = $model;
    }

Usage Example

Пример #1
0
 /**
  * @test
  * @group postgres
  */
 public function shouldBatchInsertWhenModelHasFetchedRelation()
 {
     //given
     $product1 = new Product(array('name' => 'product1'));
     $product2 = new Product(array('name' => 'product2'));
     $product1->category;
     $inserter = new BatchInserter();
     $inserter->add($product1);
     $inserter->add($product2);
     //when
     $inserter->execute();
     //then
     $this->assertNotNull(Product::where(array('name' => 'product1'))->fetch());
     $this->assertNotNull(Product::where(array('name' => 'product2'))->fetch());
 }
All Usage Examples Of Ouzo\Db\BatchInserter::add