{"action":"created","issue":{"url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle/issues/709","repository_url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle","labels_url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle/issues/709/labels{/name}","comments_url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle/issues/709/comments","events_url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle/issues/709/events","html_url":"https://github.com/ongr-io/ElasticsearchBundle/issues/709","id":189433671,"number":709,"title":"result pagination","user":{"login":"dijadev","id":22493282,"avatar_url":"https://avatars.githubusercontent.com/u/22493282?v=3","gravatar_id":"","url":"https://api.github.com/users/dijadev","html_url":"https://github.com/dijadev","followers_url":"https://api.github.com/users/dijadev/followers","following_url":"https://api.github.com/users/dijadev/following{/other_user}","gists_url":"https://api.github.com/users/dijadev/gists{/gist_id}","starred_url":"https://api.github.com/users/dijadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dijadev/subscriptions","organizations_url":"https://api.github.com/users/dijadev/orgs","repos_url":"https://api.github.com/users/dijadev/repos","events_url":"https://api.github.com/users/dijadev/events{/privacy}","received_events_url":"https://api.github.com/users/dijadev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-15T16:07:42Z","updated_at":"2016-11-17T11:15:06Z","closed_at":null,"body":"Hi! Is there any way to paginate the results ?\r\nThanks in advance,"},"comment":{"url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle/issues/comments/261221220","html_url":"https://github.com/ongr-io/ElasticsearchBundle/issues/709#issuecomment-261221220","issue_url":"https://api.github.com/repos/ongr-io/ElasticsearchBundle/issues/709","id":261221220,"user":{"login":"einorler","id":13484571,"avatar_url":"https://avatars.githubusercontent.com/u/13484571?v=3","gravatar_id":"","url":"https://api.github.com/users/einorler","html_url":"https://github.com/einorler","followers_url":"https://api.github.com/users/einorler/followers","following_url":"https://api.github.com/users/einorler/following{/other_user}","gists_url":"https://api.github.com/users/einorler/gists{/gist_id}","starred_url":"https://api.github.com/users/einorler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/einorler/subscriptions","organizations_url":"https://api.github.com/users/einorler/orgs","repos_url":"https://api.github.com/users/einorler/repos","events_url":"https://api.github.com/users/einorler/events{/privacy}","received_events_url":"https://api.github.com/users/einorler/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T11:15:06Z","updated_at":"2016-11-17T11:15:06Z","body":"I'd say it's easier with `FilterManagerBundle`. All you need is add config:\r\n\r\n```yml\r\nongr_filter_manager:\r\n    managers:\r\n        search_list:\r\n            filters:\r\n                - search_pager\r\n            repository: 'es.manager.default.product'\r\n    filters:\r\n        pager:\r\n            search_pager:\r\n                request_field: 'page'\r\n                count_per_page: 5\r\n```\r\nHandle the request in controller:\r\n```php\r\npublic function listAction(Request $request)\r\n    {\r\n        $searchList = $this->get(ONGRFilterManagerExtension::getFilterManagerId('search_list'))\r\n                      ->handleRequest($request);\r\n\r\n        return $this->render(\r\n          'AppBundle:Product:list.html.twig',\r\n          [\r\n            'filters' => $searchList->getFilters(),  // Returns filters container array\r\n            'products' => $searchList->getResult(),  //Returns result iterator\r\n          ]\r\n        );                  \r\n    }\r\n```\r\nAnd after you form your list, add the pager bar in the template:\r\n```twig\r\n{% set pagerFilter = filter_manager.getFilters().search_pager %}\r\n{{ ongr_paginate(pagerFilter.pager, app.request.attributes.get('_route'), pagerFilter.getUrlParameters()) }}\r\n```\r\n\r\nPlus with this, you can add any other filters at any time, including sorting, searching, choices and more"}}
{"actor":{"display_login":"einorler"}}