aboutsummaryrefslogtreecommitdiff
path: root/app/Models/UserQuery.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-12-28 23:58:00 +0100
committerGravatar GitHub <noreply@github.com> 2024-12-28 23:58:00 +0100
commitc29cbb7b8be95fee249ed1a21dce98a4772d92e2 (patch)
treeb116f6033ea081c6cc5f82ce83156f2a7021166c /app/Models/UserQuery.php
parent33cdfbb309c61167cf1c81273eb242f94ca8f996 (diff)
Fix regressions on some array structures (#7155)
regressions from https://github.com/FreshRSS/FreshRSS/pull/7131 fix https://github.com/FreshRSS/FreshRSS/issues/7154
Diffstat (limited to 'app/Models/UserQuery.php')
-rw-r--r--app/Models/UserQuery.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php
index 6933deb1f..196d0126e 100644
--- a/app/Models/UserQuery.php
+++ b/app/Models/UserQuery.php
@@ -21,6 +21,10 @@ class FreshRSS_UserQuery {
private string $token = '';
private bool $shareRss = false;
private bool $shareOpml = false;
+ /** @var array<int,FreshRSS_Category> $categories where the key is the category ID */
+ private array $categories;
+ /** @var array<int,FreshRSS_Tag> $labels where the key is the label ID */
+ private array $labels;
/** XML-encoded description */
private string $description = '';
private string $imageUrl = '';
@@ -40,14 +44,18 @@ class FreshRSS_UserQuery {
/**
* @param array{get?:string,name?:string,order?:string,search?:string,state?:int,url?:string,token?:string,
* shareRss?:bool,shareOpml?:bool,description?:string,imageUrl?:string} $query
- * @param array<int,FreshRSS_Category> $categories
- * @param array<int,FreshRSS_Tag> $labels
+ * @param array<FreshRSS_Category> $categories
+ * @param array<FreshRSS_Tag> $labels
*/
- public function __construct(
- array $query,
- private array $categories,
- private array $labels,
- ) {
+ public function __construct(array $query, array $categories, array $labels) {
+ $this->categories = [];
+ foreach ($categories as $category) {
+ $this->categories[$category->id()] = $category;
+ }
+ $this->labels = [];
+ foreach ($labels as $label) {
+ $this->labels[$label->id()] = $label;
+ }
if (isset($query['get'])) {
$this->parseGet($query['get']);
} else {