Skip to content
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

Make MessageTemplate.master_id fully joinable #25056

Merged
merged 1 commit into from Nov 27, 2022

Conversation

aydun
Copy link
Contributor

@aydun aydun commented Nov 25, 2022

Update to #24992

Overview

Make MessageTemplate.master_id fully joinable

Before

MessageTemplate.master_id returned the id of the master template (ie the core distributed one)
But fields of the master template like MessageTemplate.master_id.msg_subject were not returned.

After

Fields of the master template like MessageTemplate.master_id.msg_subject are returned.

Technical Details

Also moves tests out of the BAO class since these fields are not in the BAO. Enhanced tests

Comments

@colemanw

Move Calculated Field tests out of BAO tests - they're not BAO
Enhance test to check fields of master_id entity are returned.
@civibot
Copy link

civibot bot commented Nov 25, 2022

(Standard links)

@civibot civibot bot added the master label Nov 25, 2022
@@ -23,7 +23,7 @@ public function modifySpec(RequestSpec $spec) {
->setInputType('Select')
->setReadonly(TRUE)
->setFkEntity('MessageTemplate')
->setSqlRenderer([__CLASS__, 'revertible']);
->setSqlRenderer(['\Civi\Api4\Service\Schema\Joiner', 'getExtraJoinSql']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this function getting some reuse!

@colemanw
Copy link
Member

Well done @aydun - this is top-notch API work.

@colemanw colemanw merged commit 93b1722 into civicrm:master Nov 27, 2022
@aydun
Copy link
Contributor Author

aydun commented Nov 28, 2022

Thanks @colemanw - I realised that was your 'secret sauce' for avoiding duplicating the query when the calculated field is an entity ref.

@colemanw
Copy link
Member

LOL, I probably should have documented that sauce rather than keeping it secret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants