- Fixed some bugs within SearchRequestFromRequestTrait

This commit is contained in:
Dave Mc Nicoll 2024-10-14 14:41:35 +00:00
parent 3c2ae86653
commit 9503b24467
1 changed files with 8 additions and 4 deletions

View File

@ -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