Skip to content

Commit e72bcc4

Browse files
committed
Merge pull request #52 from pwoo/master
ResultCollection does not include _id as attribute.
2 parents 5a47780 + 068edfe commit e72bcc4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ElasticquentTrait.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,9 +584,11 @@ public static function typeExists()
584584
public function newFromHitBuilder($hit = array())
585585
{
586586
$instance = $this->newInstance(array(), true);
587-
588-
$attributes = $hit['_source'];
589-
587+
$keyname = $instance->getKeyName();
588+
589+
$attributes = $hit['_source'];
590+
$attributes[$keyname] = $hit['_id'];
591+
590592
// Add fields to attributes
591593
if (isset($hit['fields'])) {
592594
foreach ($hit['fields'] as $key => $value) {

0 commit comments

Comments
 (0)