{"action":"created","issue":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/10599","repository_url":"https://api.github.com/repos/civicrm/civicrm-core","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/10599/labels{/name}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/10599/comments","events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/10599/events","html_url":"https://github.com/civicrm/civicrm-core/pull/10599","id":240302426,"number":10599,"title":"CRM-20847 Support custom api with composite primary keys","user":{"login":"eileenmcnaughton","id":336308,"avatar_url":"https://avatars6.githubusercontent.com/u/336308?v=4","gravatar_id":"","url":"https://api.github.com/users/eileenmcnaughton","html_url":"https://github.com/eileenmcnaughton","followers_url":"https://api.github.com/users/eileenmcnaughton/followers","following_url":"https://api.github.com/users/eileenmcnaughton/following{/other_user}","gists_url":"https://api.github.com/users/eileenmcnaughton/gists{/gist_id}","starred_url":"https://api.github.com/users/eileenmcnaughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eileenmcnaughton/subscriptions","organizations_url":"https://api.github.com/users/eileenmcnaughton/orgs","repos_url":"https://api.github.com/users/eileenmcnaughton/repos","events_url":"https://api.github.com/users/eileenmcnaughton/events{/privacy}","received_events_url":"https://api.github.com/users/eileenmcnaughton/received_events","type":"User","site_admin":false},"labels":[{"id":246037889,"url":"https://api.github.com/repos/civicrm/civicrm-core/labels/master","name":"master","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2017-07-04T03:27:33Z","updated_at":"2017-07-16T21:55:37Z","closed_at":"2017-07-15T20:42:58Z","pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/10599","html_url":"https://github.com/civicrm/civicrm-core/pull/10599","diff_url":"https://github.com/civicrm/civicrm-core/pull/10599.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/10599.patch"},"body":"This adds a couple of checks in the api to not add the id field and adds unit tests on a custom api (albeit somewhat hacked into a single file). This is useful because in the past the hook_civicrm_EntityTypes became mandatory and broke custom api using basic_get, so valuable testing added.\r\n\r\nI also confirmed it's possible to define an fk join on a field other than id & added a test. It could have been declared in the DAO but I used a spec function to define mailing_identifier joining to civicrm_mailing.hash per code below\r\n\r\n```\r\n/**\r\n * Metadata for MailingProviderData.get API\r\n *\r\n * @param array $params\r\n *\r\n * @throws API_Exception\r\n */\r\nfunction _civicrm_api3_mailing_provider_data_get_spec(&$params) {\r\n  $params['mailing_identifier']['FKClassName'] = 'CRM_Mailing_BAO_Mailing';\r\n  $params['mailing_identifier']['FKApiName'] = 'Mailing';\r\n  $params['mailing_identifier']['FKKeyColumn'] = 'hash';\r\n}\r\n```\r\n\r\nNote that Grant is an example of an api which uses a uniqueName on\r\nid & I checked manually that is still returned. SyntaxConformance\r\ntests cover this a lot, but I still also added one check to the grant test.\r\n\r\n---\r\n\r\n * [CRM-20847: Support custom api with composite primary keys](https://issues.civicrm.org/jira/browse/CRM-20847)"},"comment":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments/315640064","html_url":"https://github.com/civicrm/civicrm-core/pull/10599#issuecomment-315640064","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/10599","id":315640064,"user":{"login":"jackrabbithanna","id":1508311,"avatar_url":"https://avatars6.githubusercontent.com/u/1508311?v=4","gravatar_id":"","url":"https://api.github.com/users/jackrabbithanna","html_url":"https://github.com/jackrabbithanna","followers_url":"https://api.github.com/users/jackrabbithanna/followers","following_url":"https://api.github.com/users/jackrabbithanna/following{/other_user}","gists_url":"https://api.github.com/users/jackrabbithanna/gists{/gist_id}","starred_url":"https://api.github.com/users/jackrabbithanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackrabbithanna/subscriptions","organizations_url":"https://api.github.com/users/jackrabbithanna/orgs","repos_url":"https://api.github.com/users/jackrabbithanna/repos","events_url":"https://api.github.com/users/jackrabbithanna/events{/privacy}","received_events_url":"https://api.github.com/users/jackrabbithanna/received_events","type":"User","site_admin":false},"created_at":"2017-07-16T21:55:37Z","updated_at":"2017-07-16T21:55:37Z","body":"@eileenmcnaughton when you feel like, please do share your concerns and the difference scenarios you foresee, in the partners channel sometime.  Your knowledge is deep, and your input both necessary and important.  "}}
{"actor":{"display_login":"jackrabbithanna"}}