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