Skip to content

Commit 92511a0

Browse files
committed
fix for root id being overwritten
1 parent 5fe1f5d commit 92511a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Query/Builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ public function orWhereIntegerNotInRaw($column, $values, $boolean = 'and')
17741774

17751775
private function aliasIdForQuery(array $values, bool $root = true): array
17761776
{
1777-
if (array_key_exists('id', $values) && ($root || $this->connection->getRenameEmbeddedIdField())) {
1777+
if (array_key_exists('id', $values) && ($this->connection->getRenameEmbeddedIdField())) {
17781778
if (array_key_exists('_id', $values) && $values['id'] !== $values['_id']) {
17791779
throw new InvalidArgumentException('Cannot have both "id" and "_id" fields.');
17801780
}
@@ -1837,7 +1837,7 @@ public function aliasIdForResult(array|object $values, bool $root = true): array
18371837
if (is_array($values)) {
18381838
if (
18391839
array_key_exists('_id', $values) && ! array_key_exists('id', $values)
1840-
&& ($root || $this->connection->getRenameEmbeddedIdField())
1840+
&& ($this->connection->getRenameEmbeddedIdField())
18411841
) {
18421842
$values['id'] = $values['_id'];
18431843
unset($values['_id']);
@@ -1856,7 +1856,7 @@ public function aliasIdForResult(array|object $values, bool $root = true): array
18561856
if ($values instanceof stdClass) {
18571857
if (
18581858
property_exists($values, '_id') && ! property_exists($values, 'id')
1859-
&& ($root || $this->connection->getRenameEmbeddedIdField())
1859+
&& ($this->connection->getRenameEmbeddedIdField())
18601860
) {
18611861
$values->id = $values->_id;
18621862
unset($values->_id);

0 commit comments

Comments
 (0)