knplabs/KnpPaginatorBundle — Issue #55: getPaginationData() -> public?
Author: gajdaw
Created: 2011-11-29 10:32:44+00:00
State: open

I need to the access to pagination data in the view. I want to generate numbers but
without using primary keys.

In order to use the result of paginationData() method I call it in the action and pass it to the view:

```php
//MyBundle/Controller/DefaultController.php
public function indexAction($page)
{
...
return array(
'pagination' => $pagination,
'pagination_data' => $pagination->getPaginationData()
);
}
```

and then use it in the view:

```html
//MyBundle/Resources/views/Default/index.html.twig

{{ pagination_data.firstItemNumber + loop.index - 1}}
{{ item.name }}

```

That's why I suggest to change getPaginationData() to public.