-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version option deprecation fix and replacements #1803
Changes from all commits
cc5d010
f1fc761
0fae95e
955d3ed
d15845e
edccc89
ac3f4ad
df38de8
2254853
d794d2b
8863cee
af0b1d5
1497fff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -323,9 +323,7 @@ protected function _processResponse(Response $response): ResponseSet | |
if (!$data->hasId() && isset($bulkResponseData['_id'])) { | ||
$data->setId($bulkResponseData['_id']); | ||
} | ||
if (isset($bulkResponseData['_version'])) { | ||
$data->setVersion($bulkResponseData['_version']); | ||
} | ||
$data->setVersionParams($bulkResponseData); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I see where we need this. Is there a better way to do this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure there's a better way, I was trying to avoid to copy/paste code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think copy/paste in this case is fine, adding another public method just for avoiding calling each setter doesn't bring so much value. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,15 +277,13 @@ public function updateDocument($id, $data, $index, array $options = []): Respons | |
|
||
$docOptions = $data->getOptions( | ||
[ | ||
'version', | ||
'version_type', | ||
Comment on lines
-280
to
-281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems the right fix as this not documented anymore: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-update.html |
||
'routing', | ||
'percolate', | ||
'parent', | ||
'retry_on_conflict', | ||
'consistency', | ||
'replication', | ||
'parent', | ||
'percolate', | ||
'refresh', | ||
'replication', | ||
'retry_on_conflict', | ||
'routing', | ||
'timeout', | ||
] | ||
); | ||
|
@@ -310,10 +308,7 @@ public function updateDocument($id, $data, $index, array $options = []): Respons | |
&& $data instanceof Document | ||
&& ($data->isAutoPopulate() || $this->getConfigValue(['document', 'autoPopulate'], false)) | ||
) { | ||
$responseData = $response->getData(); | ||
if (isset($responseData['_version'])) { | ||
$data->setVersion($responseData['_version']); | ||
Comment on lines
-314
to
-315
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this should be removed finally. As it's still documented as returned. |
||
} | ||
$data->setVersionParams($response->getData()); | ||
} | ||
|
||
return $response; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,9 +215,7 @@ public function addDocument(Document $doc): Response | |
if (isset($data['_id']) && !$doc->hasId()) { | ||
$doc->setId($data['_id']); | ||
} | ||
if (isset($data['_version'])) { | ||
$doc->setVersion($data['_version']); | ||
Comment on lines
-218
to
-219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this should be removed finally. As it's still documented as returned. |
||
} | ||
$doc->setVersionParams($data); | ||
} | ||
|
||
return $response; | ||
|
@@ -272,10 +270,10 @@ public function getDocument($id, array $options = []): Document | |
$data = []; | ||
} | ||
|
||
$document = new Document($id, $data, $this->getName()); | ||
$document->setVersion($result['_version']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure this should be removed finally. As it's still documented as returned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll put back setVersion, just remove it for a document update |
||
$doc = new Document($id, $data, $this->getName()); | ||
$doc->setVersionParams($data); | ||
|
||
return $document; | ||
return $doc; | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this method or could we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its still used to set the document version on GET