-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add contract for repositories with filters.
- Loading branch information
Showing
3 changed files
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Arxy\DoctrineORMFilters; | ||
|
||
use Doctrine\ORM\QueryBuilder; | ||
|
||
interface HasFilters | ||
{ | ||
public function createQueryBuilderByFilters( | ||
string $alias, | ||
iterable $filterBy, | ||
string $indexBy = null | ||
): QueryBuilder; | ||
|
||
public function appendFilter(QueryBuilder $queryBuilder, string $alias, string $filterName, ...$values): bool; | ||
|
||
/** | ||
* @throws \Doctrine\ORM\NonUniqueResultException | ||
*/ | ||
public function findOneByFilters(iterable $filterBy): ?object; | ||
|
||
public function findByFilters(iterable $filterBy): array; | ||
|
||
/** | ||
* @throws \Doctrine\ORM\NoResultException | ||
* @throws \Doctrine\ORM\NonUniqueResultException | ||
*/ | ||
public function getSingleResultByFilters(iterable $filterBy): object; | ||
|
||
public function countByFilters(iterable $filterBy): int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Arxy\DoctrineORMFilters\Tests; | ||
|
||
use Arxy\DoctrineORMFilters\Filters; | ||
use Arxy\DoctrineORMFilters\HasFilters; | ||
|
||
class TestRepository implements HasFilters | ||
{ | ||
use Filters; | ||
|
||
public function createQueryBuilder($alias, $indexBy = null) | ||
{ | ||
|
||
} | ||
|
||
public function getFilters(): array | ||
{ | ||
return []; | ||
} | ||
} |