-
Notifications
You must be signed in to change notification settings - Fork 189
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
implemented retrievement of id after commit() #589
Conversation
if (isset($this->persistedObjects)) { | ||
$i = 0; | ||
foreach ($this->persistedObjects as $document) { | ||
$document->id = $bulkResponse['items'][$indexing[$i]]['create']['_id']; |
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.
You can not hardcode id
property here. User is free to choose which property of a document he wants to use for Elasticsearch _id
value (using @Id
annotation).
You could get actual property from metadata collector.
Thanks for that, I've taken it into account in the latest changes |
|
||
if (isset( $mapping['aliases']['_id'])) { | ||
$id_property = $mapping['aliases']['_id']['propertyName']; | ||
$document->$id_property = $bulkResponse['items'][$indexing[$i]]['create']['_id']; |
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.
This property can be private :)
It's been remastered in #660 with grater performance. |
closes #484