{"action":"created","issue":{"url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/issues/409","repository_url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle","labels_url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/issues/409/labels{/name}","comments_url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/issues/409/comments","events_url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/issues/409/events","html_url":"https://github.com/KnpLabs/KnpPaginatorBundle/issues/409","id":213780443,"number":409,"title":"DateTime sortable","user":{"login":"Laurent3170","id":16478286,"avatar_url":"https://avatars1.githubusercontent.com/u/16478286?v=3","gravatar_id":"","url":"https://api.github.com/users/Laurent3170","html_url":"https://github.com/Laurent3170","followers_url":"https://api.github.com/users/Laurent3170/followers","following_url":"https://api.github.com/users/Laurent3170/following{/other_user}","gists_url":"https://api.github.com/users/Laurent3170/gists{/gist_id}","starred_url":"https://api.github.com/users/Laurent3170/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Laurent3170/subscriptions","organizations_url":"https://api.github.com/users/Laurent3170/orgs","repos_url":"https://api.github.com/users/Laurent3170/repos","events_url":"https://api.github.com/users/Laurent3170/events{/privacy}","received_events_url":"https://api.github.com/users/Laurent3170/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-03-13T14:18:40Z","updated_at":"2017-04-05T08:06:30Z","closed_at":null,"body":"Hi,\r\naccording to @clytemnestra in https://github.com/KnpLabs/knp-components/pull/129, it seems that it's NOT possible to sort based on a `DateTime` ?\r\n\r\nBecause, I am trying to paginate with a `DateTime` object but I receive the following error `Warning: strtolower() expects parameter 1 to be string, object given, full log is CRITICAL - Uncaught PHP Exception Symfony\\Component\\Debug\\Exception\\ContextErrorException: \"Warning: strtolower() expects parameter 1 to be string, object given\" at /.../vendor/knplabs/knp-components/src/Knp/Component/Pager/Event/Subscriber/Sortable/ArraySubscriber.php line 61`\r\n\r\nI give `a.dateTransaction` to the query which is the name of the field in the entity.\r\n\r\nSo, is it really impossible to sort on a DateTime ?"},"comment":{"url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/issues/comments/291785863","html_url":"https://github.com/KnpLabs/KnpPaginatorBundle/issues/409#issuecomment-291785863","issue_url":"https://api.github.com/repos/KnpLabs/KnpPaginatorBundle/issues/409","id":291785863,"user":{"login":"ricohumme","id":11029998,"avatar_url":"https://avatars3.githubusercontent.com/u/11029998?v=3","gravatar_id":"","url":"https://api.github.com/users/ricohumme","html_url":"https://github.com/ricohumme","followers_url":"https://api.github.com/users/ricohumme/followers","following_url":"https://api.github.com/users/ricohumme/following{/other_user}","gists_url":"https://api.github.com/users/ricohumme/gists{/gist_id}","starred_url":"https://api.github.com/users/ricohumme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ricohumme/subscriptions","organizations_url":"https://api.github.com/users/ricohumme/orgs","repos_url":"https://api.github.com/users/ricohumme/repos","events_url":"https://api.github.com/users/ricohumme/events{/privacy}","received_events_url":"https://api.github.com/users/ricohumme/received_events","type":"User","site_admin":false},"created_at":"2017-04-05T08:06:30Z","updated_at":"2017-04-05T08:06:30Z","body":"Well that depends on how you define the return type in your repository function.\r\n``` \r\npublic function findByUserId($id, array $orderBy = array(), $hydrate = false)\r\n{\r\n\t$qb = $this->createQueryBuilder('t')\r\n\t\t->join('t.user', 'u', 'WITH', 'u.id = :id')->setParameter('id', $id);\r\n\tif ($orderBy) \r\n\t\t$qb->addOrderBy($orderBy);\r\n\t\r\n\tif ($hydrate)\r\n\t\treturn $qb->getQuery()->getResult();\r\n\t\r\n\treturn $qb;\r\n}\r\n````\r\nWould be an approach without giving up on repository functionality"}}
{"actor":{"display_login":"ricohumme"}}