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