Заменить наличие причины на пункт «Где» - PullRequest
0 голосов
/ 03 мая 2020

Пожалуйста, у меня возникли некоторые проблемы в моем проекте в symfony

Как я могу заменить пункт с пунктом где в этом коде выше, потому что пункт не работает белый пагинатор в symfony

...

...

 public function getAllClients($all = true, $user = null)
{
    $qb = $this->_em->createQueryBuilder();

//

    $qb->select('u, count(ls.id) as nbr')
        ->from($this->_entityName, 'u')
        ->join(Client::class, 'c', Join::WITH, 'c.user = u.id')
        ->join(LicenceShop::class, 'ls', Join::WITH, 'ls.client = c.id')
        ->groupBy('u.id')
        ->having('nbr > 1');



    $qb->andWhere('u.roles LIKE :roles');
    $qb->setParameter('roles', '%"ROLE_CLIENT"%');

    return $qb->getQuery();
}

Спасибо вам

Когда я использую ответ symfony вот так

Невозможно сосчитать запрос, использующий предложение HAVING. Используйте выходные ходунки для нумерации страниц

и эту функцию

enter code public function show($id = null, UserRepository $userRepository, Request $request, PaginatorInterface $paginator)
{




    if($id)
        $user = $userRepository->find($id);
    else
        $user = $this->getUser();

    $client = $user->getClientInfo();
    $myClients = $userRepository->getAllClients(false, $user);

    $myClients = $paginator->paginate(
        $myClients,
        $request->query->getInt('page_c', 100)
    );





    $referal = null;
    $licences = null;
    if ($client) {
        $referal = $client->getReferal();
        $licences = $client->getLicences();
    }

    //$licences = $module->getLicences();
    return $this->render('resellers/show.html.twig', [
        'controller_name' => 'ResellersController',
        'user' => $user,
        'client' => $client,
        'referal' => $referal,
        'licences' => $licences,
        'my_clients' => $myClients,


    ]);


}
...