-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-20847 Support custom api with composite primary keys #10599
Conversation
Civi/API/SelectQuery.php
Outdated
@@ -468,7 +468,9 @@ protected function buildSelectFields() { | |||
} | |||
|
|||
// Always select the ID. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this comment be updated if it doesn't always select the ID?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed now
1d7d036
to
7e27ec0
Compare
93124bc
to
f8bf3b3
Compare
Do not add id if the field does not exist and add unit tests. This adds a couple of checks in the api to not add the id field Note that Grant is an example of an api which uses a uniqueName on id & I checked manually that is still returned. SyntaxConformance tests cover this a lot, but I still also added one check to the grant test.
f8bf3b3
to
523c222
Compare
Requires civicrm/civicrm-core#10599 in CiviCRM repo Change-Id: Ica3827b59442e4092b8b868795b24c9b7f6ef309
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for this improvement. Tested, works fine
Hmm - you should probably have merged this - now I'm going to have to merge this based on your review - which is arguably a less good process |
(thanks for the review though - note that I did discuss this with @totten on MM & he was pretty agnostic about it) |
Oh yeah Eileen the "merge police" are watching :) I'm just messing with you. Maybe its just a matter of setting some new habits...CT thumbs up on MM is "good enough" maybe, but it doesn't give anyone else the chance to see documentation of it, or at least its hard, especially as the time goes from merge to somebody looking back at the PR. If everyone sees a Core Team thumbs up on these PRs or on Jira, it definitely takes away the ambiguity. There's got to be a balance between efficiency and bureaucracy that we can strike. Nice PR here! if you ever need a "merger" let me know! |
Yep - well I think like a lot of people I'll be just taking a back seat for a while since the big blow up was about a change that had been OK'd on JIRA a few months ago by Coleman. I think if anyone doesn't feel very nervous about doing anything right now they are braver than I! |
I"m sorry you see it as a blowup...I think you can tell that there is a lot of support for this in the community. |
And maybe a little nervousness is good, shouldn't it lead to higher quality code, more review, and less regressions? |
It's possible that's how it will play out - I can also see some quite different scenarios - but I don't wish to discuss any further at this time |
@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. |
civicrm#10599 Change-Id: I64f2e5a7ed0200cc1f489ebfd30ad8d241cdad8b
Requires civicrm/civicrm-core#10599 in CiviCRM repo Change-Id: Ica3827b59442e4092b8b868795b24c9b7f6ef309
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.
I 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
Note that Grant is an example of an api which uses a uniqueName on
id & I checked manually that is still returned. SyntaxConformance
tests cover this a lot, but I still also added one check to the grant test.