add project/conference filters
This commit is contained in:
parent
f8db332058
commit
6763eedb39
6 changed files with 135 additions and 4 deletions
|
|
@ -3,8 +3,9 @@
|
|||
namespace App\Repository;
|
||||
|
||||
use App\Core\Repository\RepositoryQuery;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
use App\Entity\ThemeType;
|
||||
use App\Repository\ConferenceRepository as Repository;
|
||||
use Knp\Component\Pager\PaginatorInterface;
|
||||
|
||||
class ConferenceRepositoryQuery extends RepositoryQuery
|
||||
{
|
||||
|
|
@ -12,4 +13,25 @@ class ConferenceRepositoryQuery extends RepositoryQuery
|
|||
{
|
||||
parent::__construct($repository, 'c', $paginator);
|
||||
}
|
||||
|
||||
public function withThemeType(?ThemeType $themeType): self
|
||||
{
|
||||
if (!$themeType) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$keyId = 'id'.mt_rand();
|
||||
|
||||
return $this
|
||||
->andWhere('.themeType = :'.$keyId)
|
||||
->setParameter($keyId, $themeType->getId())
|
||||
;
|
||||
}
|
||||
|
||||
protected function filterHandler(string $name, $value)
|
||||
{
|
||||
if ('themeType' === $name) {
|
||||
return $this->withThemeType($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue