continue with optimizations

This commit is contained in:
Dennis Eichhorn 2024-01-27 08:40:30 +00:00
parent 67886a9dc8
commit b92e1f08e7
3 changed files with 10 additions and 18 deletions

View File

@ -62,7 +62,7 @@ abstract class DataMapperAbstract
* @var array
* @since 1.0.0
*/
protected array $with = [];
public array $with = [];
/**
* Sort order

View File

@ -854,13 +854,10 @@ final class ReadMapper extends DataMapperAbstract
$value = $this->populateOwnsOne($def['internal'], $result, $default);
// loads hasMany relations. other relations are loaded in the populateOwnsOne
if (\is_object($value) && isset($this->mapper::OWNS_ONE[$def['internal']]['mapper'])) {
$this->mapper::OWNS_ONE[$def['internal']]['mapper']::reader(db: $this->db)->loadHasManyRelationsTest([$value]);
}
if (empty($value)) {
// @todo find better solution. this was because of a bug with the sales billing list query depth = 4. The address was set (from the client, referral or creator) but then somehow there was a second address element which was all null and null cannot be assigned to a string variable (e.g. country). The problem with this solution is that if the model expects an initialization (e.g. at lest set the elements to null, '', 0 etc.) this is now not done.
// @todo find better solution. this was because of a bug with the sales billing list query depth = 4.
// The address was set (from the client, referral or creator) but then somehow there was a second address element which was all null and null cannot be assigned to a string variable (e.g. country).
// The problem with this solution is that if the model expects an initialization (e.g. at lest set the elements to null, '', 0 etc.) this is now not done.
$value = $isPrivate ? $refProp->getValue($obj) : $obj->{$member};
}
} elseif (isset($this->mapper::BELONGS_TO[$def['internal']])) {
@ -872,11 +869,6 @@ final class ReadMapper extends DataMapperAbstract
}
$value = $this->populateBelongsTo($def['internal'], $result, $default);
// loads hasMany relations. other relations are loaded in the populateBelongsTo
if (\is_object($value) && isset($this->mapper::BELONGS_TO[$def['internal']]['mapper'])) {
$this->mapper::BELONGS_TO[$def['internal']]['mapper']::reader(db: $this->db)->loadHasManyRelationsTest([$value]);
}
} elseif (\in_array($def['type'], ['string', 'compress', 'int', 'float', 'bool'])) {
if ($value !== null && $def['type'] === 'compress') {
$def['type'] = 'string';

View File

@ -71,7 +71,7 @@ abstract class StatusAbstract
*/
public static function activateRoutes(ModuleInfo $info, ?ApplicationInfo $appInfo = null) : void
{
self::activateRoutesHooks($info, $appInfo, 'Routes');
self::activateRoutesHooks($info, 'Routes', $appInfo);
}
/**
@ -127,7 +127,7 @@ abstract class StatusAbstract
*/
public static function activateHooks(ModuleInfo $info, ?ApplicationInfo $appInfo = null) : void
{
self::activateRoutesHooks($info, $appInfo, 'Hooks');
self::activateRoutesHooks($info, 'Hooks', $appInfo);
}
/**
@ -140,7 +140,7 @@ abstract class StatusAbstract
*
* @since 1.0.0
*/
public static function activateRoutesHooks(ModuleInfo $info, ?ApplicationInfo $appInfo = null, string $type) : void
public static function activateRoutesHooks(ModuleInfo $info, string $type, ?ApplicationInfo $appInfo = null) : void
{
$directories = new Directory(static::PATH . '/' . $type);
@ -197,7 +197,7 @@ abstract class StatusAbstract
*/
public static function deactivateRoutes(ModuleInfo $info, ?ApplicationInfo $appInfo = null) : void
{
self::deactivateRoutesHooks($info, $appInfo, 'Routes');
self::deactivateRoutesHooks($info, 'Routes', $appInfo);
}
/**
@ -210,7 +210,7 @@ abstract class StatusAbstract
*
* @since 1.0.0
*/
public static function deactivateRoutesHooks(ModuleInfo $info, ?ApplicationInfo $appInfo = null, string $type) : void
public static function deactivateRoutesHooks(ModuleInfo $info, string $type, ?ApplicationInfo $appInfo = null) : void
{
$directories = new Directory(static::PATH . '/'. $type);
@ -285,6 +285,6 @@ abstract class StatusAbstract
*/
public static function deactivateHooks(ModuleInfo $info, ?ApplicationInfo $appInfo = null) : void
{
self::deactivateRoutesHooks($info, $appInfo, 'Hooks');
self::deactivateRoutesHooks($info, 'Hooks', $appInfo);
}
}