- Added ArrayOf attributes and DatasetFill/DatasetPull events. ArrayCollection is also working with ArrayOf attributes
This commit is contained in:
1 parent
fd5d31fa17
commit
009e30eb7e
21 files changed
+322
-43
No files matched your search
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Ulmus\SearchRequest;
|
||||
|
||||
use Ulmus\Repository;
|
||||
|
||||
trait SearchRequestPaginationTrait {
|
||||
|
||||
public int $count = 0;
|
||||
@@ -72,4 +74,61 @@ trait SearchRequestPaginationTrait {
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function wheresConditions() : iterable
|
||||
{
|
||||
return array_filter(($this->wheresConditions ?? []) + [
|
||||
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function wheresOperators() : iterable
|
||||
{
|
||||
return array_filter(($this->wheresOperators ?? []) + [
|
||||
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function likesConditions() : iterable
|
||||
{
|
||||
return array_filter(($this->likesConditions ?? []) + [
|
||||
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function likesOperators() : iterable
|
||||
{
|
||||
return array_filter(($this->likesOperators ?? []) + [
|
||||
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function filter(Repository $repository) : Repository
|
||||
{
|
||||
return $repository;
|
||||
}
|
||||
|
||||
public function applyCount(Repository\RepositoryInterface $repository): SearchRequestInterface
|
||||
{
|
||||
$this->count = $this->filter($repository)
|
||||
->wheres($this->wheres(), $this->wheresOperators(), $this->wheresConditions())
|
||||
->likes($this->likes(), $this->likesConditions())
|
||||
->groups($this->groups())
|
||||
->count();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function apply(Repository\RepositoryInterface $repository): SearchRequestInterface
|
||||
{
|
||||
$this->filter($repository)
|
||||
->wheres($this->wheres(), $this->wheresOperators(), $this->wheresConditions())
|
||||
->likes($this->likes(), $this->likesConditions())
|
||||
->orders($this->orders())
|
||||
->groups($this->groups())
|
||||
->offset($this->offset())
|
||||
->limit($this->limit());
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user