Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

SetMaxResult #968

Closed
HrjSnz opened this issue Apr 13, 2021 · 1 comment
Closed

SetMaxResult #968

HrjSnz opened this issue Apr 13, 2021 · 1 comment

Comments

@HrjSnz
Copy link

HrjSnz commented Apr 13, 2021

Hello,

can you help me please ?

I need make query for only first 30 results. But i can not figure how get it.. here is code.. where and andWhere works fine.. But no with setMaxResults etc. Is there way how get it ? Thank you :)

        $datatable = $this->datatableFactory->create(WelcomeDxDatatable::class);
        $datatable->buildDatatable();
        $responseService = $this->datatableResponse;
        $responseService->setDatatable($datatable);
        
        $datatableQueryBuilder = $responseService->getDatatableQueryBuilder();
        $qb = $datatableQueryBuilder->getQb();
        $qb->where('diary.isDxSsb = 1');
        
        return $responseService->getResponse();
@HrjSnz HrjSnz closed this as completed Apr 27, 2021
@Eloar
Copy link
Contributor

Eloar commented Apr 28, 2021

@HrjSnz When preparing response for Datatable You may access QueryBuilder underneath and setup it:

//...
$datatableQueryBuilder = $responseService->getDatatableQueryBuilder();
$qb = $datatableQueryBuilder->getQb();
$qb->where('diary.isDxSsb = 1');
$qb->setMaxResults(30);

return $responseService->getResponse();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants