{"action":"created","issue":{"url":"https://api.github.com/repos/qcubed/qcubed/issues/1145","repository_url":"https://api.github.com/repos/qcubed/qcubed","labels_url":"https://api.github.com/repos/qcubed/qcubed/issues/1145/labels{/name}","comments_url":"https://api.github.com/repos/qcubed/qcubed/issues/1145/comments","events_url":"https://api.github.com/repos/qcubed/qcubed/issues/1145/events","html_url":"https://github.com/qcubed/qcubed/issues/1145","id":198121611,"number":1145,"title":"LoadAll in ORM should be generator based","user":{"login":"vaibhav-kaushal","id":2824682,"avatar_url":"https://avatars.githubusercontent.com/u/2824682?v=3","gravatar_id":"","url":"https://api.github.com/users/vaibhav-kaushal","html_url":"https://github.com/vaibhav-kaushal","followers_url":"https://api.github.com/users/vaibhav-kaushal/followers","following_url":"https://api.github.com/users/vaibhav-kaushal/following{/other_user}","gists_url":"https://api.github.com/users/vaibhav-kaushal/gists{/gist_id}","starred_url":"https://api.github.com/users/vaibhav-kaushal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vaibhav-kaushal/subscriptions","organizations_url":"https://api.github.com/users/vaibhav-kaushal/orgs","repos_url":"https://api.github.com/users/vaibhav-kaushal/repos","events_url":"https://api.github.com/users/vaibhav-kaushal/events{/privacy}","received_events_url":"https://api.github.com/users/vaibhav-kaushal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/qcubed/qcubed/milestones/12","html_url":"https://github.com/qcubed/qcubed/milestone/12","labels_url":"https://api.github.com/repos/qcubed/qcubed/milestones/12/labels","id":628132,"number":12,"title":"3.1 Release","description":"Place all after-composer issues here.","creator":{"login":"olegabr","id":2850808,"avatar_url":"https://avatars.githubusercontent.com/u/2850808?v=3","gravatar_id":"","url":"https://api.github.com/users/olegabr","html_url":"https://github.com/olegabr","followers_url":"https://api.github.com/users/olegabr/followers","following_url":"https://api.github.com/users/olegabr/following{/other_user}","gists_url":"https://api.github.com/users/olegabr/gists{/gist_id}","starred_url":"https://api.github.com/users/olegabr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olegabr/subscriptions","organizations_url":"https://api.github.com/users/olegabr/orgs","repos_url":"https://api.github.com/users/olegabr/repos","events_url":"https://api.github.com/users/olegabr/events{/privacy}","received_events_url":"https://api.github.com/users/olegabr/received_events","type":"User","site_admin":false},"open_issues":48,"closed_issues":11,"state":"open","created_at":"2014-04-12T19:49:34Z","updated_at":"2016-12-30T09:02:10Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2016-12-30T09:02:10Z","updated_at":"2016-12-30T16:08:27Z","closed_at":null,"body":"We are currently loading everything from the database into an array. This is a problem when there is not enough memory to hold all the objects. As such, it is very easy that some day when the database is big, the developer is going to hit the limit and the program will crash. \r\n\r\nWe should implement the `LoadAll` method in our generated ORM using PHP generators so that the user does not accidentally run into memory leaks. The logic that I have thought of till now is: \r\n\r\n1. The `LoadAll` method always gets **1000** items. The number **1000** is a **safe bet** for most cases. This can be customizable. \r\n2. It **yields** one element from the 1000 which it had queried and updates the internal counter of how many items were returned.\r\n3. If it has finished yielding all 1000 objects, it can query the database again to get another set (1001-2000) and start returning them. \r\n4. If database returns 0 results, the function will **return** and finish its run. \r\n\r\nThoughts? \r\n\r\nPS: I realize that Generators are available in PHP 5.5 and above. Hence, we will have to make PHP version 5.5 is a minimum for version 3.1"},"comment":{"url":"https://api.github.com/repos/qcubed/qcubed/issues/comments/269788710","html_url":"https://github.com/qcubed/qcubed/issues/1145#issuecomment-269788710","issue_url":"https://api.github.com/repos/qcubed/qcubed/issues/1145","id":269788710,"user":{"login":"spekary","id":755757,"avatar_url":"https://avatars.githubusercontent.com/u/755757?v=3","gravatar_id":"","url":"https://api.github.com/users/spekary","html_url":"https://github.com/spekary","followers_url":"https://api.github.com/users/spekary/followers","following_url":"https://api.github.com/users/spekary/following{/other_user}","gists_url":"https://api.github.com/users/spekary/gists{/gist_id}","starred_url":"https://api.github.com/users/spekary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spekary/subscriptions","organizations_url":"https://api.github.com/users/spekary/orgs","repos_url":"https://api.github.com/users/spekary/repos","events_url":"https://api.github.com/users/spekary/events{/privacy}","received_events_url":"https://api.github.com/users/spekary/received_events","type":"User","site_admin":false},"created_at":"2016-12-30T16:08:27Z","updated_at":"2016-12-30T16:08:27Z","body":"LoadAll should Load All. Your idea for using generators is a good one though, but give it another name (LoadCached?). However, how different is this from QueryCursor? Maybe it should use the Cursor approach to get each time? Probably should be tested to see which is more efficient."}}
{"actor":{"display_login":"spekary"}}