From bf58516985d354993fb0ab241bacda6a04bad8be Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 14 Jan 2026 09:45:41 +0200 Subject: [PATCH 1/4] skipFilters --- src/Database/Database.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index 7f62679e8..7307dd2dd 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -393,9 +393,9 @@ class Database protected bool $filter = true; /** - * @var array|null + * @var array */ - protected ?array $disabledFilters = []; + protected array $disabledFilters = []; protected bool $validate = true; @@ -8463,22 +8463,16 @@ protected function encodeAttribute(string $name, mixed $value, Document $documen */ protected function decodeAttribute(string $filter, mixed $value, Document $document, string $attribute): mixed { - if (!$this->filter) { - return $value; - } - - if (!\is_null($this->disabledFilters) && isset($this->disabledFilters[$filter])) { - return $value; - } + $skip = $this->filter === false || isset($this->disabledFilters[$filter]); if (!array_key_exists($filter, self::$filters) && !array_key_exists($filter, $this->instanceFilters)) { throw new NotFoundException("Filter \"{$filter}\" not found for attribute \"{$attribute}\""); } if (array_key_exists($filter, $this->instanceFilters)) { - $value = $this->instanceFilters[$filter]['decode']($value, $document, $this); + $value = $this->instanceFilters[$filter]['decode']( $value, $document, $this, skip: $skip); } else { - $value = self::$filters[$filter]['decode']($value, $document, $this); + $value = self::$filters[$filter]['decode']($value, $document, $this, skip: $skip); } return $value; From c16243435cf433b3c2fd40873bf023428fe92e9c Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 14 Jan 2026 09:48:53 +0200 Subject: [PATCH 2/4] linter --- src/Database/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index 7307dd2dd..c015b6b02 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -8470,7 +8470,7 @@ protected function decodeAttribute(string $filter, mixed $value, Document $docum } if (array_key_exists($filter, $this->instanceFilters)) { - $value = $this->instanceFilters[$filter]['decode']( $value, $document, $this, skip: $skip); + $value = $this->instanceFilters[$filter]['decode']($value, $document, $this, skip: $skip); } else { $value = self::$filters[$filter]['decode']($value, $document, $this, skip: $skip); } From e47fd0704f2e530f5c3098239d243c841c774fab Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 14 Jan 2026 10:08:49 +0200 Subject: [PATCH 3/4] AddSkip --- src/Database/Database.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index c015b6b02..2d727550e 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -545,7 +545,7 @@ function (mixed $value) { * @param string|null $value * @return array|null */ - function (?string $value) { + function (?string $value, bool $skip) { if ($value === null) { return null; } @@ -573,7 +573,7 @@ function (mixed $value) { * @param string|null $value * @return array|null */ - function (?string $value) { + function (?string $value, bool $skip) { if (is_null($value)) { return null; } @@ -601,7 +601,7 @@ function (mixed $value) { * @param string|null $value * @return array|null */ - function (?string $value) { + function (?string $value, bool $skip) { if (is_null($value)) { return null; } @@ -8470,9 +8470,9 @@ protected function decodeAttribute(string $filter, mixed $value, Document $docum } if (array_key_exists($filter, $this->instanceFilters)) { - $value = $this->instanceFilters[$filter]['decode']($value, $document, $this, skip: $skip); + $value = $this->instanceFilters[$filter]['decode']($value, $document, $this, $skip); } else { - $value = self::$filters[$filter]['decode']($value, $document, $this, skip: $skip); + $value = self::$filters[$filter]['decode']($value, $document, $this, $skip); } return $value; From 87038defccbf8ccc76e80daf9cd31bb94020c1e6 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 14 Jan 2026 10:10:28 +0200 Subject: [PATCH 4/4] AddSkip --- src/Database/Database.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index 2d727550e..d7b674e45 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -545,7 +545,7 @@ function (mixed $value) { * @param string|null $value * @return array|null */ - function (?string $value, bool $skip) { + function (?string $value) { if ($value === null) { return null; } @@ -573,7 +573,7 @@ function (mixed $value) { * @param string|null $value * @return array|null */ - function (?string $value, bool $skip) { + function (?string $value) { if (is_null($value)) { return null; } @@ -601,7 +601,7 @@ function (mixed $value) { * @param string|null $value * @return array|null */ - function (?string $value, bool $skip) { + function (?string $value) { if (is_null($value)) { return null; }