| @@ 116-127 (lines=12) @@ | ||
| 113 | * @param array $objects array of domain model objects |
|
| 114 | * @param string Method to call |
|
| 115 | */ |
|
| 116 | public function insertMany(array $objects) |
|
| 117 | { |
|
| 118 | $documents = array(); |
|
| 119 | foreach ($objects as $object) { |
|
| 120 | $documents[] = $this->transformToElasticaDocument($object); |
|
| 121 | } |
|
| 122 | try { |
|
| 123 | $this->type->addDocuments($documents); |
|
| 124 | } catch (BulkException $e) { |
|
| 125 | $this->log($e); |
|
| 126 | } |
|
| 127 | } |
|
| 128 | ||
| 129 | /** |
|
| 130 | * Bulk update an array of objects in the type. Create document if it does not already exist. |
|
| @@ 155-166 (lines=12) @@ | ||
| 152 | * |
|
| 153 | * @param array $objects array of domain model objects |
|
| 154 | */ |
|
| 155 | public function deleteMany(array $objects) |
|
| 156 | { |
|
| 157 | $documents = array(); |
|
| 158 | foreach ($objects as $object) { |
|
| 159 | $documents[] = $this->transformToElasticaDocument($object); |
|
| 160 | } |
|
| 161 | try { |
|
| 162 | $this->type->deleteDocuments($documents); |
|
| 163 | } catch (BulkException $e) { |
|
| 164 | $this->log($e); |
|
| 165 | } |
|
| 166 | } |
|
| 167 | ||
| 168 | /** |
|
| 169 | * Bulk deletes records from an array of identifiers. |
|