From bf3fba022be353d4e640c4333a725e0e5d79f3a1 Mon Sep 17 00:00:00 2001 From: christophboecker Date: Fri, 6 Sep 2024 18:18:08 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Status-Abfrage=20"online":=20=20>=3D=20in?= =?UTF-8?q?=20=3D=20ge=C3=A4ndert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Api/Restful.php | 4 ++-- lib/Entry.php | 6 +++--- lib/neues.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Api/Restful.php b/lib/Api/Restful.php index 25c2535..751a540 100644 --- a/lib/Api/Restful.php +++ b/lib/Api/Restful.php @@ -17,7 +17,7 @@ public static function init(): void 'path' => '/neues/entry/5.0.0/', 'auth' => '\rex_yform_rest_auth_token::checkToken', 'type' => Entry::class, - 'query' => Entry::query()->where('status', 1, '>='), + 'query' => Entry::query()->where('status', 1, '='), 'get' => [ 'fields' => [ Entry::class => [ @@ -105,7 +105,7 @@ public static function init(): void 'path' => '/neues/category/5.0.0/', 'auth' => '\rex_yform_rest_auth_token::checkToken', 'type' => Category::class, - 'query' => Category::query()->where('status', 1, '>='), + 'query' => Category::query()->where('status', 1, '='), 'get' => [ 'fields' => [ Category::class => [ diff --git a/lib/Entry.php b/lib/Entry.php index 647709e..0bd6475 100644 --- a/lib/Entry.php +++ b/lib/Entry.php @@ -501,7 +501,7 @@ public static function findOnline(?int $category_id = null): rex_yform_manager_c if (null !== $category_id) { return self::findByCategory($category_id); } - return self::query()->where('status', 1, '>=')->find(); + return self::query()->where('status', 1, '=')->find(); } /** @@ -521,7 +521,7 @@ public static function findByCategory(?int $category_id = null, int $status = 1) { $query = self::query(); $alias = $query->getTableAlias(); - $query->joinRelation('category_ids', 'c')->where($alias . '.status', $status, '>=')->where('c.id', $category_id); + $query->joinRelation('category_ids', 'c')->where($alias . '.status', $status, '=')->where('c.id', $category_id); return $query->find(); } @@ -540,7 +540,7 @@ public static function findByCategory(?int $category_id = null, int $status = 1) */ public static function findByCategoryIds(string|array|null $category_ids = null, int $status = 1): rex_yform_manager_collection { - $query = self::query()->where('status', $status, '>='); + $query = self::query()->where('status', $status, '='); if ($category_ids) { // Wenn es ein String ist, in ein Array umwandeln diff --git a/lib/neues.php b/lib/neues.php index 3935d71..91cf585 100644 --- a/lib/neues.php +++ b/lib/neues.php @@ -27,7 +27,7 @@ class Neues public static function getList(int $rowsPerPage = 10, string $pageCursor = 'page'): string { $query = Entry::query() - ->where('status', 1, '>=') + ->where('status', 1, '=') ->where('publishdate', rex_sql::datetime(), '<=') ->orderBy('publishdate', 'desc'); $pager = new rex_pager($rowsPerPage, $pageCursor); From fd9f85f4dffb1b27a399bcccba68d85814f8327c Mon Sep 17 00:00:00 2001 From: christophboecker Date: Fri, 6 Sep 2024 18:32:08 +0200 Subject: [PATCH 2/2] '=' entfernt da Default-Wert --- lib/Api/Restful.php | 4 ++-- lib/Entry.php | 6 +++--- lib/neues.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Api/Restful.php b/lib/Api/Restful.php index 751a540..f0e4ded 100644 --- a/lib/Api/Restful.php +++ b/lib/Api/Restful.php @@ -17,7 +17,7 @@ public static function init(): void 'path' => '/neues/entry/5.0.0/', 'auth' => '\rex_yform_rest_auth_token::checkToken', 'type' => Entry::class, - 'query' => Entry::query()->where('status', 1, '='), + 'query' => Entry::query()->where('status', 1), 'get' => [ 'fields' => [ Entry::class => [ @@ -105,7 +105,7 @@ public static function init(): void 'path' => '/neues/category/5.0.0/', 'auth' => '\rex_yform_rest_auth_token::checkToken', 'type' => Category::class, - 'query' => Category::query()->where('status', 1, '='), + 'query' => Category::query()->where('status', 1), 'get' => [ 'fields' => [ Category::class => [ diff --git a/lib/Entry.php b/lib/Entry.php index 0bd6475..2970c0c 100644 --- a/lib/Entry.php +++ b/lib/Entry.php @@ -501,7 +501,7 @@ public static function findOnline(?int $category_id = null): rex_yform_manager_c if (null !== $category_id) { return self::findByCategory($category_id); } - return self::query()->where('status', 1, '=')->find(); + return self::query()->where('status', 1)->find(); } /** @@ -521,7 +521,7 @@ public static function findByCategory(?int $category_id = null, int $status = 1) { $query = self::query(); $alias = $query->getTableAlias(); - $query->joinRelation('category_ids', 'c')->where($alias . '.status', $status, '=')->where('c.id', $category_id); + $query->joinRelation('category_ids', 'c')->where($alias . '.status', $status)->where('c.id', $category_id); return $query->find(); } @@ -540,7 +540,7 @@ public static function findByCategory(?int $category_id = null, int $status = 1) */ public static function findByCategoryIds(string|array|null $category_ids = null, int $status = 1): rex_yform_manager_collection { - $query = self::query()->where('status', $status, '='); + $query = self::query()->where('status', $status); if ($category_ids) { // Wenn es ein String ist, in ein Array umwandeln diff --git a/lib/neues.php b/lib/neues.php index 91cf585..81218a9 100644 --- a/lib/neues.php +++ b/lib/neues.php @@ -27,7 +27,7 @@ class Neues public static function getList(int $rowsPerPage = 10, string $pageCursor = 'page'): string { $query = Entry::query() - ->where('status', 1, '=') + ->where('status', 1) ->where('publishdate', rex_sql::datetime(), '<=') ->orderBy('publishdate', 'desc'); $pager = new rex_pager($rowsPerPage, $pageCursor);