mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 05:38:39 +00:00
reduce has many query complexity
This commit is contained in:
parent
c9c41a7212
commit
0fd9b3edd7
|
|
@ -861,6 +861,12 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$objectMapper = $this->createRelationMapper($many['mapper']::get(db: $this->db), $member);
|
||||||
|
if ($many['external'] === null) {
|
||||||
|
$objectMapper->where($many['mapper']::COLUMNS[$many['self']]['internal'], $primaryKey);
|
||||||
|
} else {
|
||||||
|
// @todo: don't do this, even in a many-many relationship I should be able to use joins which the above if branch effectively is!
|
||||||
|
|
||||||
$query = new Builder($this->db, true);
|
$query = new Builder($this->db, true);
|
||||||
$src = $many['external'] ?? $many['mapper']::PRIMARYFIELD;
|
$src = $many['external'] ?? $many['mapper']::PRIMARYFIELD;
|
||||||
|
|
||||||
|
|
@ -886,9 +892,10 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$objects = $this->createRelationMapper($many['mapper']::get(db: $this->db), $member)
|
$objectMapper->where($many['mapper']::COLUMNS[$many['mapper']::PRIMARYFIELD]['internal'], $result, 'IN')->execute();
|
||||||
->where($many['mapper']::COLUMNS[$many['mapper']::PRIMARYFIELD]['internal'], $result, 'in')
|
}
|
||||||
->execute();
|
|
||||||
|
$objects = $objectMapper->execute();
|
||||||
|
|
||||||
if ($refClass === null) {
|
if ($refClass === null) {
|
||||||
$refClass = new \ReflectionClass($obj);
|
$refClass = new \ReflectionClass($obj);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user