{"action":"created","issue":{"url":"https://api.github.com/repos/doctrine/doctrine2/issues/2596","repository_url":"https://api.github.com/repos/doctrine/doctrine2","labels_url":"https://api.github.com/repos/doctrine/doctrine2/issues/2596/labels{/name}","comments_url":"https://api.github.com/repos/doctrine/doctrine2/issues/2596/comments","events_url":"https://api.github.com/repos/doctrine/doctrine2/issues/2596/events","html_url":"https://github.com/doctrine/doctrine2/issues/2596","id":120667434,"number":2596,"title":"DDC-1927: Pagination of a SELECT of specific fields results in a RuntimeException","user":{"login":"doctrinebot","id":2414358,"avatar_url":"https://avatars.githubusercontent.com/u/2414358?v=3","gravatar_id":"","url":"https://api.github.com/users/doctrinebot","html_url":"https://github.com/doctrinebot","followers_url":"https://api.github.com/users/doctrinebot/followers","following_url":"https://api.github.com/users/doctrinebot/following{/other_user}","gists_url":"https://api.github.com/users/doctrinebot/gists{/gist_id}","starred_url":"https://api.github.com/users/doctrinebot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doctrinebot/subscriptions","organizations_url":"https://api.github.com/users/doctrinebot/orgs","repos_url":"https://api.github.com/users/doctrinebot/repos","events_url":"https://api.github.com/users/doctrinebot/events{/privacy}","received_events_url":"https://api.github.com/users/doctrinebot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/doctrine/doctrine2/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/doctrine/doctrine2/labels/Can't%20Fix","name":"Can't Fix","color":"000000"}],"state":"closed","locked":false,"assignee":{"login":"Ocramius","id":154256,"avatar_url":"https://avatars.githubusercontent.com/u/154256?v=3","gravatar_id":"","url":"https://api.github.com/users/Ocramius","html_url":"https://github.com/Ocramius","followers_url":"https://api.github.com/users/Ocramius/followers","following_url":"https://api.github.com/users/Ocramius/following{/other_user}","gists_url":"https://api.github.com/users/Ocramius/gists{/gist_id}","starred_url":"https://api.github.com/users/Ocramius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ocramius/subscriptions","organizations_url":"https://api.github.com/users/Ocramius/orgs","repos_url":"https://api.github.com/users/Ocramius/repos","events_url":"https://api.github.com/users/Ocramius/events{/privacy}","received_events_url":"https://api.github.com/users/Ocramius/received_events","type":"User","site_admin":false},"milestone":null,"comments":16,"created_at":"2012-07-16T10:10:55Z","updated_at":"2016-06-22T00:25:06Z","closed_at":"2015-12-06T22:55:28Z","body":"Jira issue originally created by user netiul:\n\nWhen paginating a DQL string which selects specific fields it results in the following error: PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'Not all identifier properties can be found in the ResultSetMapping: id'\n\nNOT working: 'SELECT c.id, c.number FROM Application\\Entity\\Course c'\nWORKING: 'SELECT c FROM Application\\Entity\\Course c'\nWORKING: 'SELECT c, c.id, c.number FROM Application\\Entity\\Course c'\n\nSetting hydration mode to scalar results makes no difference.\n\nGist to example code and stack trace: https://gist.github.com/d5cd6d0b0ac28e722dd7"},"comment":{"url":"https://api.github.com/repos/doctrine/doctrine2/issues/comments/227610901","html_url":"https://github.com/doctrine/doctrine2/issues/2596#issuecomment-227610901","issue_url":"https://api.github.com/repos/doctrine/doctrine2/issues/2596","id":227610901,"user":{"login":"asifaglodiya","id":13325928,"avatar_url":"https://avatars.githubusercontent.com/u/13325928?v=3","gravatar_id":"","url":"https://api.github.com/users/asifaglodiya","html_url":"https://github.com/asifaglodiya","followers_url":"https://api.github.com/users/asifaglodiya/followers","following_url":"https://api.github.com/users/asifaglodiya/following{/other_user}","gists_url":"https://api.github.com/users/asifaglodiya/gists{/gist_id}","starred_url":"https://api.github.com/users/asifaglodiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asifaglodiya/subscriptions","organizations_url":"https://api.github.com/users/asifaglodiya/orgs","repos_url":"https://api.github.com/users/asifaglodiya/repos","events_url":"https://api.github.com/users/asifaglodiya/events{/privacy}","received_events_url":"https://api.github.com/users/asifaglodiya/received_events","type":"User","site_admin":false},"created_at":"2016-06-22T00:25:06Z","updated_at":"2016-06-22T00:25:06Z","body":"You can use the DoctrineDbalAdapter to select specific columns from the table\r\n\r\n<?php\r\n\r\nuse Pagerfanta\\Adapter\\DoctrineDbalAdapter;\r\nuse Doctrine\\DBAL\\Query\\QueryBuilder;\r\n\r\n$queryBuilder = new QueryBuilder($conn);\r\n$queryBuilder->select('p.id, p.name,p.date_created')->from('posts', 'p');\r\n\r\n$countQueryBuilderModifier = function ($queryBuilder) {\r\n    $queryBuilder->select('COUNT(DISTINCT p.id) AS total_results')\r\n          ->setMaxResults(1);\r\n};\r\n\r\n$adapter = new DoctrineDbalAdapter($queryBuilder, $countQueryBuilderModifier);\r\n        $pagerfanta = new Pagerfanta($adapter);\r\n        $pagerfanta->setMaxPerPage(15); // 10 by default\r\n\r\n        $page = $request->query->get('page', 1);        \r\n        $pagerfanta->setCurrentPage($page); // 1 by default\r\n\r\n        if ($pagerfanta->hasPreviousPage()) {\r\n            $pagerfanta->getPreviousPage();\r\n        }\r\n        if ($pagerfanta->hasNextPage()) {\r\n            $pagerfanta->getNextPage();\r\n        }\r\n        \r\n        return $this->render(TestManagerBundle:Post:index.html.twig', \r\n                array('pagination' => $pagerfanta));"}}
{"actor":{"display_login":"asifaglodiya"}}