1: <?php
2:
3: namespace PHPixie\ORM\Steps\Step\Query\Insert;
4:
5: class Batch extends \PHPixie\ORM\Steps\Step\Query\Insert
6: {
7: protected $queryPlanner;
8: protected $dataStep;
9:
10: public function __construct($queryPlanner, $insertQuery, $dataStep)
11: {
12: $this->queryPlanner = $queryPlanner;
13: $this->dataStep = $dataStep;
14: parent::__construct($insertQuery);
15: }
16:
17: public function execute()
18: {
19: $data = $this->dataStep->data();
20:
21: if(!empty($data)) {
22: $this->queryPlanner->setBatchData($this->query, $this->dataStep->fields(), $data);
23: parent::execute();
24: }
25: }
26: }