38 lines
896 B
PHP
38 lines
896 B
PHP
<?php
|
|
|
|
namespace App\Repository;
|
|
|
|
use App\Core\Repository\RepositoryQuery;
|
|
use App\Entity\ThemeType;
|
|
use App\Repository\ConferenceRepository as Repository;
|
|
use Knp\Component\Pager\PaginatorInterface;
|
|
|
|
class ConferenceRepositoryQuery extends RepositoryQuery
|
|
{
|
|
public function __construct(Repository $repository, PaginatorInterface $paginator)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|