{"action":"created","issue":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7534","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7534/labels{/name}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7534/comments","events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7534/events","html_url":"https://github.com/civicrm/civicrm-core/pull/7534","id":124855184,"number":7534,"title":"CRM-17645 - Add hook_civicrm_entityGet","user":{"login":"colemanw","id":2874912,"avatar_url":"https://avatars.githubusercontent.com/u/2874912?v=3","gravatar_id":"","url":"https://api.github.com/users/colemanw","html_url":"https://github.com/colemanw","followers_url":"https://api.github.com/users/colemanw/followers","following_url":"https://api.github.com/users/colemanw/following{/other_user}","gists_url":"https://api.github.com/users/colemanw/gists{/gist_id}","starred_url":"https://api.github.com/users/colemanw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colemanw/subscriptions","organizations_url":"https://api.github.com/users/colemanw/orgs","repos_url":"https://api.github.com/users/colemanw/repos","events_url":"https://api.github.com/users/colemanw/events{/privacy}","received_events_url":"https://api.github.com/users/colemanw/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/civicrm/civicrm-core/labels/master","name":"master","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-04T22:36:45Z","updated_at":"2016-01-05T00:52:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/7534","html_url":"https://github.com/civicrm/civicrm-core/pull/7534","diff_url":"https://github.com/civicrm/civicrm-core/pull/7534.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/7534.patch"},"body":null},"comment":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments/168857615","html_url":"https://github.com/civicrm/civicrm-core/pull/7534#issuecomment-168857615","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/7534","id":168857615,"user":{"login":"totten","id":1336047,"avatar_url":"https://avatars.githubusercontent.com/u/1336047?v=3","gravatar_id":"","url":"https://api.github.com/users/totten","html_url":"https://github.com/totten","followers_url":"https://api.github.com/users/totten/followers","following_url":"https://api.github.com/users/totten/following{/other_user}","gists_url":"https://api.github.com/users/totten/gists{/gist_id}","starred_url":"https://api.github.com/users/totten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/totten/subscriptions","organizations_url":"https://api.github.com/users/totten/orgs","repos_url":"https://api.github.com/users/totten/repos","events_url":"https://api.github.com/users/totten/events{/privacy}","received_events_url":"https://api.github.com/users/totten/received_events","type":"User","site_admin":false},"created_at":"2016-01-05T00:52:46Z","updated_at":"2016-01-05T00:52:46Z","body":"Seems like a useful hook -- might be more useful if you can access `$params`. Then you change the interpretation of certain filters or add custom filters.\r\n\r\nIdeally, I think it should pass through `$apiRequest` (which provides a somewhat normalized representation of the API call), e.g.\r\n\r\n```\r\n/**\r\n * @param array $apiRequest\r\n *   The full API request, with the parsed entity, action, params, etal. (See Civi\\API\\Request::create).\r\n * @param CRM_Utils_SQL_Select $query\r\n *   The alterable query.\r\n */\r\nfunction hook_civicrm_entityGet($apiRequest, $query)\r\n```\r\n\r\nHowever, most of the flows around `_civicrm_api3_basic_get()` don't currently provide access to `$apiRequest`, so it's a little tricky to get a reference to it. Maybe:\r\n a. Sprinkle `$apiRequest` around the various places which call `_civicrm_api3_basic_get()`. There are ~80 boring places which call it using a simple formula, and ~16 novel places. Example: https://gist.github.com/totten/44891ccdf88ea59fadff\r\n b. Keep track of the active API requests. (Since API requests sometimes overlap, use a stack.) https://gist.github.com/totten/f3288da69b06fc0d10c3"}}