Skip to content

Commit

Permalink
minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Eichhorn committed Jan 30, 2024
1 parent 01649f0 commit 84fa783
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions DataStorage/Database/Mapper/ReadMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ public function execute(mixed ...$options) : mixed
*/
public function executeGet(?Builder $query = null) : mixed
{
// Get initialized objects from memory cache.
$objs = [];
$objs = [];
$indexed = [];

$hasFactory = $this->mapper::hasFactory();
Expand Down Expand Up @@ -1206,27 +1205,25 @@ public function loadHasManyRelations(array $objs) : void
$relMapper = $this->createRelationMapper($relation['mapper']::reader($this->db), $member);

$isPrivate = $relation['private'] ?? false;
$tempObjs = [];

if ($isPrivate) {
if ($refClass === null) {
$refClass = new \ReflectionClass($obj);
}

$refProp = $refClass->getProperty($member);

$tempObjs = [];
foreach ($objs as $obj) {
$tempObjs[] = $refProp->getValue($obj);
}

$relMapper->loadHasManyRelations($tempObjs);
} else {
$tempObjs = [];
foreach ($objs as $obj) {
$tempObjs[] = $obj->{$member};
}

$relMapper->loadHasManyRelations($tempObjs);
}

$relMapper->loadHasManyRelations($tempObjs);
}
}
}
Expand Down

0 comments on commit 84fa783

Please sign in to comment.