From 9503b24467ac6f508f7bc656bfff0ca4c26f7ba8 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Mon, 14 Oct 2024 14:41:35 +0000 Subject: [PATCH 1/2] - Fixed some bugs within SearchRequestFromRequestTrait --- src/SearchRequest/SearchRequestFromRequestTrait.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/SearchRequest/SearchRequestFromRequestTrait.php b/src/SearchRequest/SearchRequestFromRequestTrait.php index c7a244a..a2db547 100644 --- a/src/SearchRequest/SearchRequestFromRequestTrait.php +++ b/src/SearchRequest/SearchRequestFromRequestTrait.php @@ -62,6 +62,10 @@ trait SearchRequestFromRequestTrait $value = $this->getValueFromSource($request, $propertyName, $attribute); + if ($value !== null) { + $value = $this->transformValue($property->getAttributes(Attribute\PropertyValueModifier::class), $value); + } + switch(true) { case $attribute instanceof SearchGroupBy: $this->parseAttributeGroupBy($attribute, $field, $propertyName); @@ -70,9 +74,7 @@ trait SearchRequestFromRequestTrait case $attribute instanceof SearchWhere: case $attribute instanceof SearchLike: case $attribute instanceof SearchManual: - if ($value !== null) { - $value = $this->transformValue($property->getAttributes(Attribute\PropertyValueModifier::class), $value); - } + if ($attribute->toggle) { $this->$propertyName = !empty($value); @@ -182,7 +184,9 @@ trait SearchRequestFromRequestTrait protected function parseAttributeOrderBy(object $attribute, string $field, mixed $propertyName,) : void { - $this->orders[$field] = $this->$propertyName; + if ( ! empty($this->$propertyName) ) { + $this->orders[$field] = $this->$propertyName; + } } protected function parseAttributeGroupBy(object $attribute, string $field, mixed $propertyName,) : void From 18313fd7f5c11eb018418764bfada2e3f94b947f Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Mon, 14 Oct 2024 14:43:03 +0000 Subject: [PATCH 2/2] - Forgot to set escapeIdentifier as static --- src/Adapter/MsSQL.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Adapter/MsSQL.php b/src/Adapter/MsSQL.php index 7e1ae5f..7b161df 100644 --- a/src/Adapter/MsSQL.php +++ b/src/Adapter/MsSQL.php @@ -203,8 +203,8 @@ class MsSQL implements AdapterInterface, MigrateInterface, SqlAdapterInterface { $this->traceOn = $configuration['trace_on']; } } - - public function escapeIdentifier(string $segment, int $type) : string + + public static function escapeIdentifier(string $segment, int $type) : string { switch($type) { case static::IDENTIFIER_SCHEMA: