File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 12
12
use Yiisoft \Db \Exception \InvalidConfigException ;
13
13
use Yiisoft \Db \Exception \NotSupportedException ;
14
14
use Yiisoft \Db \Expression \ExpressionInterface ;
15
+ use Yiisoft \Db \Query \BatchQueryResultInterface ;
15
16
use Yiisoft \Db \Query \DataReaderInterface ;
16
17
use Yiisoft \Db \Query \Query ;
17
18
use Yiisoft \Db \Query \QueryInterface ;
@@ -843,8 +844,15 @@ public function getModel(): ActiveRecordInterface
843
844
return clone $ this ->model ;
844
845
}
845
846
847
+ public function batch (int $ batchSize = 100 ): BatchQueryResultInterface
848
+ {
849
+ /** @psalm-suppress InvalidArgument */
850
+ return parent ::batch ($ batchSize )->indexBy (null )->resultCallback ($ this ->index (...));
851
+ }
852
+
846
853
protected function index (array $ rows ): array
847
854
{
855
+ /** @var list<array> $rows */
848
856
return ArArrayHelper::index ($ this ->populate ($ rows ), $ this ->indexBy );
849
857
}
850
858
You can’t perform that action at this time.
0 commit comments