コード例 #1
0
ファイル: Delete.php プロジェクト: harp-orm/harp
 public function models(Models $models)
 {
     $key = $this->getRepo()->getPrimaryKey();
     $ids = $models->pluckProperty($key);
     $this->whereIn($key, $ids);
     return $this;
 }
コード例 #2
0
ファイル: ModelsTest.php プロジェクト: harp-orm/harp
 /**
  * @covers ::pluckProperty
  */
 public function testPluckProperty()
 {
     $models = new Models([new City(['id' => 10, 'name' => 'test1']), new City(['id' => 20, 'name' => 'test2'])]);
     $expected = [10, 20];
     $this->assertSame($expected, $models->pluckProperty('id'));
     $expected = ['test1', 'test2'];
     $this->assertSame($expected, $models->pluckProperty('name'));
 }