- Started working on decoupling QueryBuilder from SqlQueryBuilder
- WIP on SearchRequest attributes - Began working on removing 'Ulmus' class - WIP on removing SQL query building from Repository (which will become SqlRepository)
This commit is contained in:
1 parent
4571517dc8
commit
9fdebf454d
21 files changed
+114
-127
No files matched your search
@@ -46,38 +46,43 @@ trait SearchRequestFromRequestTrait
|
||||
|
||||
$field = (string) $fieldName;
|
||||
|
||||
switch ($attribute->method) {
|
||||
case SearchMethodEnum::Where:
|
||||
$this->wheres[$field] = $this->$propertyName;
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::Like:
|
||||
$this->likes[$field] = "%{$this->$propertyName}%";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::LikeLeft:
|
||||
$this->likes[$field] = "%{$this->$propertyName}";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::LikeRight:
|
||||
$this->likes[$field] = "{$this->$propertyName}%";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::OrderByAsc:
|
||||
$this->orders[$field] = "ASC";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::OrderByDesc:
|
||||
$this->orders[$field] = "DESC";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::GroupBy:
|
||||
$this->groups[$field] = "DESC";
|
||||
break;
|
||||
}
|
||||
$this->parseAttributeMethod($attribute, $field, $propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function parseAttributeMethod(object $attribute, string $field, string $propertyName,) : void
|
||||
{
|
||||
switch ($attribute->method) {
|
||||
case SearchMethodEnum::Where:
|
||||
$this->wheres[$field] = $this->$propertyName;
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::Like:
|
||||
$this->likes[$field] = "%{$this->$propertyName}%";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::LikeLeft:
|
||||
$this->likes[$field] = "%{$this->$propertyName}";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::LikeRight:
|
||||
$this->likes[$field] = "{$this->$propertyName}%";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::OrderByAsc:
|
||||
$this->orders[$field] = "ASC";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::OrderByDesc:
|
||||
$this->orders[$field] = "DESC";
|
||||
break;
|
||||
|
||||
case SearchMethodEnum::GroupBy:
|
||||
$this->groups[$field] = "DESC";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user