Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
67 | public function insert(array $document) |
||
68 | { |
||
69 | // validate |
||
70 | if ($this->isValidationEnabled) { |
||
71 | $this->validator->merge($document); |
||
72 | $isValid = $this->validator->isValid(); |
||
73 | $this->validator->reset(); |
||
74 | if (!$isValid) { |
||
75 | throw new InvalidDocumentException('Document is invalid on batch insert'); |
||
76 | } |
||
77 | } |
||
78 | |||
79 | // add to batch |
||
80 | $this->add($document); |
||
81 | return $this; |
||
82 | } |
||
83 | } |
||
84 |