From af056dc36318214f0acf124cef09aa600782816f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 17 Apr 2021 07:49:10 +0200 Subject: [PATCH 1/3] Fix anonymous class detection --- src/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model.php b/src/Model.php index 6a97a9e1e..7b75345e3 100644 --- a/src/Model.php +++ b/src/Model.php @@ -854,7 +854,7 @@ public function setId($value) public function getModelCaption(): string { return $this->caption ?: $this->readableCaption( - strpos(static::class, 'class@anonymous') === 0 ? get_parent_class(static::class) : static::class + (new \ReflectionClass(static::class))->isAnonymous() ? get_parent_class(static::class) : static::class ); } From af124fc35b9631249e20ff58d390f4cd623f52c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 17 Apr 2021 08:01:10 +0200 Subject: [PATCH 2/3] Fix next ver --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7d30808ef..2d8b26daa 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "require-release": { "php": ">=7.3.0", "ext-intl": "*", - "atk4/dsql": "~2.4.0", + "atk4/dsql": "~2.5.0", "mahalux/atk4-hintable": "~1.2.1" }, "conflict": { From a931134b69fed0f8757dc40288a96acf056c3f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Sat, 17 Apr 2021 13:18:59 +0200 Subject: [PATCH 3/3] small refactor --- src/Persistence/Sql.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Persistence/Sql.php b/src/Persistence/Sql.php index c695d16f4..902e03c3c 100644 --- a/src/Persistence/Sql.php +++ b/src/Persistence/Sql.php @@ -364,12 +364,15 @@ protected function setLimitOrder(Model $model, Query $query) } /** - * Will apply a condition defined inside $condition or $model->scope() onto $query. + * Will apply $model->scope() conditions onto $query. */ - public function initQueryConditions(Model $model, Query $query, Model\Scope\AbstractScope $condition = null): void + public function initQueryConditions(Model $model, Query $query): void { - $condition = $condition ?? $model->scope(); + $this->_initQueryConditions($query, $model->scope()); + } + private function _initQueryConditions(Query $query, Model\Scope\AbstractScope $condition = null): void + { if (!$condition->isEmpty()) { // peel off the single nested scopes to convert (((field = value))) to field = value $condition = $condition->simplify(); @@ -384,7 +387,7 @@ public function initQueryConditions(Model $model, Query $query, Model\Scope\Abst $expression = $condition->isOr() ? $query->orExpr() : $query->andExpr(); foreach ($condition->getNestedConditions() as $nestedCondition) { - $this->initQueryConditions($model, $expression, $nestedCondition); + $this->_initQueryConditions($expression, $nestedCondition); } $query->where($expression);