You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometime, we need to generate just of count all results after getting limited records for pagination. Is it possible to add 3rd parameter in find all function in modeling data and update it like below. code which is working fine, or provide a function to set reset function at model level, so it can be done on/off as required.
/**
* Works with the current Query Builder instance to return
* all results, while optionally limiting them.
*
* @param integer $limit
* @param integer $offset
* @param boolean $reset
*
* @return array
*/
public function findAll(int $limit = 0, int $offset = 0,$reset = true)
{
$builder = $this->builder();
In the described use case, you should first use countAllResults(false) method. Parameter false will prevent resetting the query. After this, you can use findAll() method.
Sometime, we need to generate just of count all results after getting limited records for pagination. Is it possible to add 3rd parameter in find all function in modeling data and update it like below. code which is working fine, or provide a function to set reset function at model level, so it can be done on/off as required.
/**
* Works with the current Query Builder instance to return
* all results, while optionally limiting them.
*
* @param integer $limit
* @param integer $offset
* @param boolean $reset
*
* @return array
*/
public function findAll(int $limit = 0, int $offset = 0,$reset = true)
{
$builder = $this->builder();
Many thanks for making Codeigniter 4 in good shape.
The text was updated successfully, but these errors were encountered: