{"action":"created","issue":{"url":"https://api.github.com/repos/j4mie/idiorm/issues/302","repository_url":"https://api.github.com/repos/j4mie/idiorm","labels_url":"https://api.github.com/repos/j4mie/idiorm/issues/302/labels{/name}","comments_url":"https://api.github.com/repos/j4mie/idiorm/issues/302/comments","events_url":"https://api.github.com/repos/j4mie/idiorm/issues/302/events","html_url":"https://github.com/j4mie/idiorm/issues/302","id":155294514,"number":302,"title":"Persistent \"LIMIT 1\" after count() call on find_many()","user":{"login":"giorgiomarzianidepaolis-was","id":3170860,"avatar_url":"https://avatars.githubusercontent.com/u/3170860?v=3","gravatar_id":"","url":"https://api.github.com/users/giorgiomarzianidepaolis-was","html_url":"https://github.com/giorgiomarzianidepaolis-was","followers_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/followers","following_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/following{/other_user}","gists_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/subscriptions","organizations_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/orgs","repos_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/repos","events_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiomarzianidepaolis-was/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-05-17T15:48:42Z","updated_at":"2016-08-31T22:50:11Z","closed_at":"2016-08-31T22:50:11Z","body":"Even it's not the cleanest way to do _(I would recommend to execute find_many() and count items php side)_, this is weird:\r\n\r\n`$res = ORM::for_table('foo')->where('bar', 'foo');`\r\n`if ($res->count() > 0) {`\r\n`    $results = $res->find_many();`\r\n`}`\r\n\r\nIf you execute _find_many()_ after _count()_, it will return only first results. \r\nDebugging queries, I can see LIMIT 1 is included in the _find_many()_ query."},"comment":{"url":"https://api.github.com/repos/j4mie/idiorm/issues/comments/243926494","html_url":"https://github.com/j4mie/idiorm/issues/302#issuecomment-243926494","issue_url":"https://api.github.com/repos/j4mie/idiorm/issues/302","id":243926494,"user":{"login":"treffynnon","id":65215,"avatar_url":"https://avatars.githubusercontent.com/u/65215?v=3","gravatar_id":"","url":"https://api.github.com/users/treffynnon","html_url":"https://github.com/treffynnon","followers_url":"https://api.github.com/users/treffynnon/followers","following_url":"https://api.github.com/users/treffynnon/following{/other_user}","gists_url":"https://api.github.com/users/treffynnon/gists{/gist_id}","starred_url":"https://api.github.com/users/treffynnon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treffynnon/subscriptions","organizations_url":"https://api.github.com/users/treffynnon/orgs","repos_url":"https://api.github.com/users/treffynnon/repos","events_url":"https://api.github.com/users/treffynnon/events{/privacy}","received_events_url":"https://api.github.com/users/treffynnon/received_events","type":"User","site_admin":false},"created_at":"2016-08-31T22:50:11Z","updated_at":"2016-08-31T22:50:11Z","body":"State is maintained on the ORM object. You need to have two separate ORM objects or clone the first like:\r\n\r\n```php\r\n$res = ORM::for_table('foo')->where('bar', 'foo');\r\n$cnt = clone $res;\r\nif ($cnt->count() > 0) {\r\n    $results = $res->find_many();\r\n}\r\n```"}}
{"actor":{"display_login":"treffynnon"}}