{ | { | ||||
public function __construct(FileRepository $repository, PaginatorInterface $paginator) | public function __construct(FileRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'file', $paginator); | |||||
} | } | ||||
} | } |
{ | { | ||||
public function __construct(NewsletterRepository $repository, PaginatorInterface $paginator) | public function __construct(NewsletterRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'newsletter', $paginator); | |||||
} | } | ||||
} | } |
public function __construct(ReminderRepository $repository, PaginatorInterface $paginator) | public function __construct(ReminderRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'reminder', $paginator); | |||||
} | } | ||||
public function filterByDone($done = false): self | public function filterByDone($done = false): self | ||||
$this->isJoinUser = true; | $this->isJoinUser = true; | ||||
return $this | return $this | ||||
->leftJoin('.users', 'u'); | |||||
->leftJoin('.users', 'users'); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
{ | { | ||||
$this->joinUser(); | $this->joinUser(); | ||||
return $this | return $this | ||||
->having('COUNT(u.id) = 0') | |||||
->having('COUNT(users.id) = 0') | |||||
->orHaving(':user MEMBER OF .users') | ->orHaving(':user MEMBER OF .users') | ||||
->setParameter(':user', $user); | ->setParameter(':user', $user); | ||||
} | } |
{ | { | ||||
public function __construct(SiteSettingRepository $repository, PaginatorInterface $paginator) | public function __construct(SiteSettingRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'siteSetting', $paginator); | |||||
} | } | ||||
} | } |
public function __construct(NewsRepository $repository, PaginatorInterface $paginator) | public function __construct(NewsRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'news', $paginator); | |||||
} | } | ||||
} | } |
{ | { | ||||
public function __construct(PageRepository $repository, PaginatorInterface $paginator) | public function __construct(PageRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'page', $paginator); | |||||
} | } | ||||
} | } |
{ | { | ||||
public function __construct(SiteRepository $repository, PaginatorInterface $paginator) | public function __construct(SiteRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'site', $paginator); | |||||
} | } | ||||
} | } |
{ | { | ||||
public function __construct(TicketMessageRepository $repository, PaginatorInterface $paginator) | public function __construct(TicketMessageRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'ticketMessage', $paginator); | |||||
} | } | ||||
public function filterByTicket(TicketInterface $ticket) | public function filterByTicket(TicketInterface $ticket) |
public function __construct(TicketRepository $repository, PaginatorInterface $paginator) | public function __construct(TicketRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'ticket', $paginator); | |||||
} | } | ||||
public function filterByUser(UserInterface $user): self | public function filterByUser(UserInterface $user): self | ||||
$this->joinUser(); | $this->joinUser(); | ||||
return $this | return $this | ||||
->andWhere('.visitorFirstname LIKE :firstname OR u.firstname LIKE :firstname') | |||||
->andWhere('.visitorFirstname LIKE :firstname OR user.firstname LIKE :firstname') | |||||
->setParameter('firstname', $firstname); | ->setParameter('firstname', $firstname); | ||||
} | } | ||||
$this->joinUser(); | $this->joinUser(); | ||||
return $this | return $this | ||||
->andWhere('.visitorLastname LIKE :lastname OR u.lastname LIKE :lastname') | |||||
->andWhere('.visitorLastname LIKE :lastname OR user.lastname LIKE :lastname') | |||||
->setParameter('lastname', $lastname); | ->setParameter('lastname', $lastname); | ||||
} | } | ||||
$this->joinUser(); | $this->joinUser(); | ||||
return $this | return $this | ||||
->andWhere('.visitorEmail LIKE :email OR u.email LIKE :email') | |||||
->andWhere('.visitorEmail LIKE :email OR user.email LIKE :email') | |||||
->setParameter('email', $email); | ->setParameter('email', $email); | ||||
} | } | ||||
public function selectCount(): self | public function selectCount(): self | ||||
{ | { | ||||
return $this | return $this | ||||
->select('count(r.id) as count'); | |||||
->select('count(ticket.id) as count'); | |||||
} | } | ||||
} | } |
$query | $query | ||||
->filterByStatus(Ticket::TICKET_STATUS_OPEN) | ->filterByStatus(Ticket::TICKET_STATUS_OPEN) | ||||
->limit($limit) | ->limit($limit) | ||||
->orderBy('r.id', 'DESC'); | |||||
->orderBy('.id', 'DESC'); | |||||
return $query->find(); | return $query->find(); | ||||
} | } |
{ | { | ||||
public function __construct(GroupUserRepository $repository, PaginatorInterface $paginator) | public function __construct(GroupUserRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'groupUser', $paginator); | |||||
} | } | ||||
protected $isJoinUsers = false; | protected $isJoinUsers = false; | ||||
if (!$this->isJoinUsers) { | if (!$this->isJoinUsers) { | ||||
$this->isJoinUsers = true; | $this->isJoinUsers = true; | ||||
return $this | return $this | ||||
->innerJoin('.users', 'user'); | |||||
->innerJoin('.users', 'users'); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } |
{ | { | ||||
public function __construct(UserRepository $repository, PaginatorInterface $paginator) | public function __construct(UserRepository $repository, PaginatorInterface $paginator) | ||||
{ | { | ||||
parent::__construct($repository, 'r', $paginator); | |||||
parent::__construct($repository, 'user', $paginator); | |||||
} | } | ||||
protected $isJoinGroupUsers = false; | protected $isJoinGroupUsers = false; | ||||
if (!$this->isJoinGroupUsers) { | if (!$this->isJoinGroupUsers) { | ||||
$this->isJoinGroupUsers = true; | $this->isJoinGroupUsers = true; | ||||
$this->innerJoin('.groupUsers', 'groupUser'); | |||||
$this->innerJoin('.groupUsers', 'groupUsers'); | |||||
if($addSelect){ | if($addSelect){ | ||||
$this->addSelect('groupUser'); | |||||
$this->addSelect('groupUsers'); | |||||
} | } | ||||
} | } | ||||
return $this; | return $this; |