-
Notifications
You must be signed in to change notification settings - Fork 32
Feature request: pagination support in JsonModel #24
Comments
@kukoman is this still an issue? Maybe your paginator and not the page_size was set to 10? |
yep, still the same behavior to better explain whats going on: // my EquipmentResource::fetchAll method
public function fetchAll($params = array())
{
$adapter = new ArrayAdapter($this->getEquipmentService()->fetchAll($params));
$collection = new EquipmentCollection($adapter);
return $collection;
}
// zf-rest config:
'Mcm\\V1\\Rest\\Equipment\\Controller' => array(
'listener' => 'Mcm\\V1\\Rest\\Equipment\\EquipmentResource',
'route_name' => 'mcm.rest.equipment',
'route_identifier_name' => 'equipment_id',
'collection_name' => 'equipment',
'entity_http_methods' => array(
0 => 'GET',
1 => 'PATCH',
2 => 'PUT',
3 => 'DELETE',
),
'collection_http_methods' => array(
0 => 'GET',
1 => 'POST',
),
'collection_query_whitelist' => array(
0 => 'orderBy',
1 => 'query',
2 => 'filter',
),
'page_size' => 100,
'page_size_param' => 100,
'entity_class' => 'Mcm\\V1\\Rest\\Equipment\\EquipmentEntity',
'collection_class' => 'Mcm\\V1\\Rest\\Equipment\\EquipmentCollection',
'service_name' => 'Equipment',
), and still you get only 10 results if I change it from JSON to HAL it works as expected |
You could set it in the collection class. This is because the collection extends from Paginator class SomeCollection extends Paginator
{
protected static $defaultItemCountPerPage = 10;
} |
The root cause is because the The $collection->setCurrentPageNumber($request->getQuery('page', 1));
$collection->setItemCountPerPage(25); // you might want to inject this value from configuration We may add pagination support to zf-content-negotiation's |
This repository has been closed and moved to laminas-api-tools/api-tools-content-negotiation; a new issue has been opened at laminas-api-tools/api-tools-content-negotiation#12. |
Hi;
if i use "Content Negotiation Selector": Json; the paginator is not working correctly and
i always get 10 rows in collection, if i change it to HalJson it works as expecting
example:
The text was updated successfully, but these errors were encountered: