Browse Source

ticket news user repo

feature/symfony6.1
Charly 3 years ago
parent
commit
8139c91dd0
3 changed files with 7 additions and 27 deletions
  1. +0
    -3
      Repository/Site/NewsRepositoryQuery.php
  2. +1
    -19
      Repository/Ticket/TicketStore.php
  3. +6
    -5
      Repository/User/UserRepository.php

+ 0
- 3
Repository/Site/NewsRepositoryQuery.php View File

@@ -3,15 +3,12 @@
namespace Lc\SovBundle\Repository\Site;

use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
use Lc\CaracoleBundle\Repository\StatusRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class NewsRepositoryQuery extends AbstractRepositoryQuery implements NewsRepositoryQueryInterface
{
use StatusRepositoryQueryTrait;
use MerchantRepositoryQueryTrait;

public function __construct(NewsRepository $repository, PaginatorInterface $paginator)
{

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

@@ -42,17 +42,8 @@ class TicketStore extends AbstractStore implements TicketStoreInterface
return $query->find();
}

// public function findAllOpen($limit = 0)
// {
// $query = $this->findByMerchantQuery();
// $this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN]);
// $query->addOrderBy('e.id', 'DESC');
// $query->setMaxResults($limit);
// return $query->getQuery()->getResult();
// }

//countAllOpen
public function countAllOpen($query = null)
public function countAllOpen($query = null): string
{
if (is_null($query)) {
$query = $this->query->create();
@@ -63,13 +54,4 @@ class TicketStore extends AbstractStore implements TicketStoreInterface

return $query->count();
}


// public function countAllOpen()
// {
// $query = $this->findByMerchantQuery();
// $query->select('count(e.id)');
// $this->filterStatus($query, [Ticket::TICKET_STATUS_OPEN]);
// return $query->getQuery()->getSingleScalarResult();
// }
}

+ 6
- 5
Repository/User/UserRepository.php View File

@@ -29,11 +29,12 @@ class UserRepository extends AbstractRepository
$this->_em->flush();
}

public function findByRole($role) {
public function findByRole($role)
{
return $this->createQueryBuilder('u')
->andWhere('u.roles LIKE :role')
->setParameter('role', '%'.$role.'%')
->getQuery()
->getResult();
->andWhere('u.roles LIKE :role')
->setParameter('role', '%' . $role . '%')
->getQuery()
->getResult();
}
}

Loading…
Cancel
Save