feat: filter assignments and applications by teamer name
closes #869b9vgq7
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Entity\Assignment;
|
||||
use App\Entity\Teamer;
|
||||
use App\Model\ApplicationFilterDto;
|
||||
use App\Model\AssignmentFilterDto;
|
||||
use App\Repository\Traits\QueryHelperTrait;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
@@ -21,6 +22,8 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||
*/
|
||||
class ApplicationRepository extends ServiceEntityRepository
|
||||
{
|
||||
use QueryHelperTrait;
|
||||
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, Application::class);
|
||||
@@ -109,6 +112,17 @@ class ApplicationRepository extends ServiceEntityRepository
|
||||
;
|
||||
}
|
||||
|
||||
$teamerName = $filterDto->getTeamerName();
|
||||
if (null !== $teamerName && '' !== trim($teamerName)) {
|
||||
$qb
|
||||
->andWhere($qb->expr()->orX(
|
||||
$qb->expr()->like('user.firstName', ':teamerName'),
|
||||
$qb->expr()->like('user.lastName', ':teamerName')
|
||||
))
|
||||
->setParameter('teamerName', '%'.$this->escapeLikeWildcards($teamerName).'%')
|
||||
;
|
||||
}
|
||||
|
||||
return $qb->getQuery();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user