| @@ 90-100 (lines=11) @@ | ||
| 87 | return $models; |
|
| 88 | } |
|
| 89 | ||
| 90 | public function insert(Storable $model) |
|
| 91 | { |
|
| 92 | $collection = new ElasticsearchCollectionParser($model->getCollectionName()); |
|
| 93 | $params = [ |
|
| 94 | 'index' => $collection->getIndex(), |
|
| 95 | 'type' => $collection->getType(), |
|
| 96 | 'id' => $model->getPrimaryKey(), |
|
| 97 | 'body' => $model->toArray() |
|
| 98 | ]; |
|
| 99 | $this->client->index($params); |
|
| 100 | } |
|
| 101 | ||
| 102 | public function update(Storable $model) |
|
| 103 | { |
|
| @@ 102-112 (lines=11) @@ | ||
| 99 | $this->client->index($params); |
|
| 100 | } |
|
| 101 | ||
| 102 | public function update(Storable $model) |
|
| 103 | { |
|
| 104 | $collection = new ElasticsearchCollectionParser($model->getCollectionName()); |
|
| 105 | $params = [ |
|
| 106 | 'index' => $collection->getIndex(), |
|
| 107 | 'type' => $collection->getType(), |
|
| 108 | 'id' => $model->getPrimaryKey(), |
|
| 109 | 'body' => $model->toArray() |
|
| 110 | ]; |
|
| 111 | $this->client->index($params); |
|
| 112 | } |
|
| 113 | ||
| 114 | public function delete(Storable $model) |
|
| 115 | { |
|
| @@ 114-123 (lines=10) @@ | ||
| 111 | $this->client->index($params); |
|
| 112 | } |
|
| 113 | ||
| 114 | public function delete(Storable $model) |
|
| 115 | { |
|
| 116 | $collection = new ElasticsearchCollectionParser($model->getCollectionName()); |
|
| 117 | $params = [ |
|
| 118 | 'index' => $collection->getIndex(), |
|
| 119 | 'type' => $collection->getType(), |
|
| 120 | 'id' => $model->getPrimaryKey() |
|
| 121 | ]; |
|
| 122 | $this->client->delete($params); |
|
| 123 | } |
|
| 124 | } |
|