Skip to content

Commit 8cae8ec

Browse files
committed
Only hydrate entity when data exists
1 parent a4fb80c commit 8cae8ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/LightQL/Entities/EntityManager.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ public function find(string $entityClass, $id): Entity
122122
->where($where)
123123
->selectFirst();
124124

125-
$entity->hydrate($raw);
125+
if (is_array($raw)) {
126+
$entity->hydrate($raw);
127+
}
126128

127-
return$entity;
129+
return $entity;
128130
}
129131

130132
/**

0 commit comments

Comments
 (0)