Browse Source

Refactoring repositoryQuery id d'entité

develop
Fabien Normand 3 years ago
parent
commit
45e7d63d5a
12 changed files with 21 additions and 21 deletions
  1. +1
    -1
      Repository/File/FileRepositoryQuery.php
  2. +1
    -1
      Repository/Newsletter/NewsletterRepositoryQuery.php
  3. +3
    -3
      Repository/Reminder/ReminderRepositoryQuery.php
  4. +1
    -1
      Repository/Setting/SiteSettingRepositoryQuery.php
  5. +1
    -1
      Repository/Site/NewsRepositoryQuery.php
  6. +1
    -1
      Repository/Site/PageRepositoryQuery.php
  7. +1
    -1
      Repository/Site/SiteRepositoryQuery.php
  8. +1
    -1
      Repository/Ticket/TicketMessageRepositoryQuery.php
  9. +5
    -5
      Repository/Ticket/TicketRepositoryQuery.php
  10. +1
    -1
      Repository/Ticket/TicketStore.php
  11. +2
    -2
      Repository/User/GroupUserRepositoryQuery.php
  12. +3
    -3
      Repository/User/UserRepositoryQuery.php

+ 1
- 1
Repository/File/FileRepositoryQuery.php View File

@@ -9,6 +9,6 @@ class FileRepositoryQuery extends AbstractRepositoryQuery implements FileReposit
{
public function __construct(FileRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'file', $paginator);
}
}

+ 1
- 1
Repository/Newsletter/NewsletterRepositoryQuery.php View File

@@ -9,6 +9,6 @@ class NewsletterRepositoryQuery extends AbstractRepositoryQuery implements Newsl
{
public function __construct(NewsletterRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'newsletter', $paginator);
}
}

+ 3
- 3
Repository/Reminder/ReminderRepositoryQuery.php View File

@@ -12,7 +12,7 @@ class ReminderRepositoryQuery extends AbstractRepositoryQuery implements Reminde

public function __construct(ReminderRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'reminder', $paginator);
}

public function filterByDone($done = false): self
@@ -28,7 +28,7 @@ class ReminderRepositoryQuery extends AbstractRepositoryQuery implements Reminde
$this->isJoinUser = true;

return $this
->leftJoin('.users', 'u');
->leftJoin('.users', 'users');
}
return $this;
}
@@ -37,7 +37,7 @@ class ReminderRepositoryQuery extends AbstractRepositoryQuery implements Reminde
{
$this->joinUser();
return $this
->having('COUNT(u.id) = 0')
->having('COUNT(users.id) = 0')
->orHaving(':user MEMBER OF .users')
->setParameter(':user', $user);
}

+ 1
- 1
Repository/Setting/SiteSettingRepositoryQuery.php View File

@@ -9,6 +9,6 @@ class SiteSettingRepositoryQuery extends AbstractRepositoryQuery implements Site
{
public function __construct(SiteSettingRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'siteSetting', $paginator);
}
}

+ 1
- 1
Repository/Site/NewsRepositoryQuery.php View File

@@ -10,6 +10,6 @@ class NewsRepositoryQuery extends AbstractRepositoryQuery implements NewsReposit

public function __construct(NewsRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'news', $paginator);
}
}

+ 1
- 1
Repository/Site/PageRepositoryQuery.php View File

@@ -9,7 +9,7 @@ class PageRepositoryQuery extends AbstractRepositoryQuery implements PageReposit
{
public function __construct(PageRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'page', $paginator);
}

}

+ 1
- 1
Repository/Site/SiteRepositoryQuery.php View File

@@ -9,6 +9,6 @@ class SiteRepositoryQuery extends AbstractRepositoryQuery implements SiteReposit
{
public function __construct(SiteRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'site', $paginator);
}
}

+ 1
- 1
Repository/Ticket/TicketMessageRepositoryQuery.php View File

@@ -10,7 +10,7 @@ class TicketMessageRepositoryQuery extends AbstractRepositoryQuery implements Ti
{
public function __construct(TicketMessageRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'ticketMessage', $paginator);
}

public function filterByTicket(TicketInterface $ticket)

+ 5
- 5
Repository/Ticket/TicketRepositoryQuery.php View File

@@ -13,7 +13,7 @@ class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRep

public function __construct(TicketRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'ticket', $paginator);
}

public function filterByUser(UserInterface $user): self
@@ -46,7 +46,7 @@ class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRep
$this->joinUser();

return $this
->andWhere('.visitorFirstname LIKE :firstname OR u.firstname LIKE :firstname')
->andWhere('.visitorFirstname LIKE :firstname OR user.firstname LIKE :firstname')
->setParameter('firstname', $firstname);
}

@@ -55,7 +55,7 @@ class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRep
$this->joinUser();

return $this
->andWhere('.visitorLastname LIKE :lastname OR u.lastname LIKE :lastname')
->andWhere('.visitorLastname LIKE :lastname OR user.lastname LIKE :lastname')
->setParameter('lastname', $lastname);
}

@@ -64,13 +64,13 @@ class TicketRepositoryQuery extends AbstractRepositoryQuery implements TicketRep
$this->joinUser();

return $this
->andWhere('.visitorEmail LIKE :email OR u.email LIKE :email')
->andWhere('.visitorEmail LIKE :email OR user.email LIKE :email')
->setParameter('email', $email);
}

public function selectCount(): self
{
return $this
->select('count(r.id) as count');
->select('count(ticket.id) as count');
}
}

+ 1
- 1
Repository/Ticket/TicketStore.php View File

@@ -50,7 +50,7 @@ class TicketStore extends AbstractStore implements TicketStoreInterface
$query
->filterByStatus(Ticket::TICKET_STATUS_OPEN)
->limit($limit)
->orderBy('r.id', 'DESC');
->orderBy('.id', 'DESC');

return $query->find();
}

+ 2
- 2
Repository/User/GroupUserRepositoryQuery.php View File

@@ -9,7 +9,7 @@ class GroupUserRepositoryQuery extends AbstractRepositoryQuery implements GroupU
{
public function __construct(GroupUserRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'groupUser', $paginator);
}

protected $isJoinUsers = false;
@@ -20,7 +20,7 @@ class GroupUserRepositoryQuery extends AbstractRepositoryQuery implements GroupU
if (!$this->isJoinUsers) {
$this->isJoinUsers = true;
return $this
->innerJoin('.users', 'user');
->innerJoin('.users', 'users');
}
return $this;
}

+ 3
- 3
Repository/User/UserRepositoryQuery.php View File

@@ -11,7 +11,7 @@ class UserRepositoryQuery extends AbstractRepositoryQuery implements UserReposit
{
public function __construct(UserRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
parent::__construct($repository, 'user', $paginator);
}

protected $isJoinGroupUsers = false;
@@ -21,9 +21,9 @@ class UserRepositoryQuery extends AbstractRepositoryQuery implements UserReposit
if (!$this->isJoinGroupUsers) {
$this->isJoinGroupUsers = true;

$this->innerJoin('.groupUsers', 'groupUser');
$this->innerJoin('.groupUsers', 'groupUsers');
if($addSelect){
$this->addSelect('groupUser');
$this->addSelect('groupUsers');
}
}
return $this;

Loading…
Cancel
Save