- Added some SearchRequest attributes ; now it's even simpler to add searchable fields
- Began decoupling of QueryBuilder from native MySQL method ; some works needs to be done on for the Repository object splitting also.
This commit is contained in:
1 parent
15be1597b8
commit
4571517dc8
30 files changed
+1007
-615
No files matched your search
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\SearchRequest;
|
||||
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Ulmus\Repository;
|
||||
|
||||
class SearchRequest implements SearchRequestInterface
|
||||
{
|
||||
use SearchRequestPaginationTrait, SearchRequestFromRequestTrait;
|
||||
|
||||
public function filter(Repository $repository) : Repository
|
||||
{
|
||||
return $repository;
|
||||
}
|
||||
|
||||
public function wheres() : iterable
|
||||
{
|
||||
return array_filter($this->wheres + [
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function likes(): iterable
|
||||
{
|
||||
return array_filter($this->likes + [
|
||||
], fn($i) => ! is_null($i) ) + [];
|
||||
}
|
||||
|
||||
public function groups(): iterable
|
||||
{
|
||||
return array_filter($this->groups + [
|
||||
], fn($e) => ! is_null($e) && $e !== "" );
|
||||
}
|
||||
|
||||
public function orders(): iterable
|
||||
{
|
||||
return array_filter($this->orders + [
|
||||
], fn($e) => ! is_null($e) && $e !== "" );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user