{"action":"created","issue":{"url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/94","labels_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/94/comments","events_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/94/events","html_url":"https://github.com/avenirer/CodeIgniter-MY_Model/issues/94","id":121534804,"number":94,"title":"Observers $after_get","user":{"login":"dreammonkey","id":371355,"avatar_url":"https://avatars.githubusercontent.com/u/371355?v=3","gravatar_id":"","url":"https://api.github.com/users/dreammonkey","html_url":"https://github.com/dreammonkey","followers_url":"https://api.github.com/users/dreammonkey/followers","following_url":"https://api.github.com/users/dreammonkey/following{/other_user}","gists_url":"https://api.github.com/users/dreammonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/dreammonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreammonkey/subscriptions","organizations_url":"https://api.github.com/users/dreammonkey/orgs","repos_url":"https://api.github.com/users/dreammonkey/repos","events_url":"https://api.github.com/users/dreammonkey/events{/privacy}","received_events_url":"https://api.github.com/users/dreammonkey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-10T17:13:12Z","updated_at":"2015-12-10T20:07:42Z","closed_at":null,"body":"hi There,\r\n\r\nGreat work ! I was using Base model for a long time, this is a very welcome update !\r\n\r\nI was messing around with the model and I might have found an issue with the after_get observer....\r\n\r\nSay you want to modify some fields in a record using after_get.\r\nThe after_get observer only seems to work when fetching a single record -> get(1)\r\nWhen fetching many records ->get_all() the supplied method gets all the records returned at once (as an array)...\r\n\r\nWhen using return_as 'array' there is no way to distinguish between a single record result and multiple records. (Not an obvious one that is...)\r\n\r\nAm I right or should I implement this logic in another way ?\r\n\r\nThanks for your feedback and many thanks for the awesome work you put in this !\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/comments/163735888","html_url":"https://github.com/avenirer/CodeIgniter-MY_Model/issues/94#issuecomment-163735888","issue_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/94","id":163735888,"user":{"login":"avenirer","id":3034772,"avatar_url":"https://avatars.githubusercontent.com/u/3034772?v=3","gravatar_id":"","url":"https://api.github.com/users/avenirer","html_url":"https://github.com/avenirer","followers_url":"https://api.github.com/users/avenirer/followers","following_url":"https://api.github.com/users/avenirer/following{/other_user}","gists_url":"https://api.github.com/users/avenirer/gists{/gist_id}","starred_url":"https://api.github.com/users/avenirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avenirer/subscriptions","organizations_url":"https://api.github.com/users/avenirer/orgs","repos_url":"https://api.github.com/users/avenirer/repos","events_url":"https://api.github.com/users/avenirer/events{/privacy}","received_events_url":"https://api.github.com/users/avenirer/received_events","type":"User","site_admin":false},"created_at":"2015-12-10T20:07:42Z","updated_at":"2015-12-10T20:07:42Z","body":"Well... a get would return you a single row... while a get_all() would return you multiple rows, right? So you can ask the array that comes inside the after_get observer if it is an associative one (that is the case for a single row) or not (that is the case for multiple rows)... ;)"}}