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