frontend, localization, bugfix

This commit is contained in:
2023-01-15 00:32:17 +01:00
parent 0418118841
commit 1d6ff17994
18 changed files with 297 additions and 84 deletions

View File

@@ -94,7 +94,9 @@ class DatabaseEntityQuery extends Select {
$relIndex = 1;
foreach ($this->handler->getRelations() as $propertyName => $relationHandler) {
$this->fetchRelation($propertyName, $this->handler->getTableName(), $this->handler, $relationHandler, $relIndex, $recursive);
if ($this->handler !== $relationHandler) {
$this->fetchRelation($propertyName, $this->handler->getTableName(), $this->handler, $relationHandler, $relIndex, $recursive);
}
}
return $this;
@@ -117,7 +119,6 @@ class DatabaseEntityQuery extends Select {
$alias = "t$relIndex"; // t1, t2, t3, ...
$relIndex++;
if ($isNullable) {
$this->leftJoin($referencedTable, "$tableName.$foreignColumnName", "$alias.id", $alias);
} else {
@@ -153,21 +154,21 @@ class DatabaseEntityQuery extends Select {
if ($this->resultType === SQL::FETCH_ALL) {
$entities = [];
foreach ($res as $row) {
$entity = $this->handler->entityFromRow($row, $this->additionalColumns, $this->fetchSubEntities !== self::FETCH_NONE);
$entity = $this->handler->entityFromRow($row, $this->additionalColumns, $this->fetchSubEntities);
if ($entity) {
$entities[$entity->getId()] = $entity;
}
}
if ($this->fetchSubEntities !== self::FETCH_NONE) {
$this->handler->fetchNMRelations($entities, $this->fetchSubEntities === self::FETCH_RECURSIVE);
$this->handler->fetchNMRelations($entities, $this->fetchSubEntities);
}
return $entities;
} else if ($this->resultType === SQL::FETCH_ONE) {
$entity = $this->handler->entityFromRow($res, $this->additionalColumns, $this->fetchSubEntities !== self::FETCH_NONE);
$entity = $this->handler->entityFromRow($res, $this->additionalColumns, $this->fetchSubEntities);
if ($entity instanceof DatabaseEntity && $this->fetchSubEntities !== self::FETCH_NONE) {
$this->handler->fetchNMRelations([$entity->getId() => $entity], $this->fetchSubEntities === self::FETCH_RECURSIVE);
$this->handler->fetchNMRelations([$entity->getId() => $entity], $this->fetchSubEntities);
}
return $entity;