-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
Api4 - Support entities in alternate databases #32474
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
I think we have been doing this by including the database in the table name |
@eileenmcnaughton who has been doing it? |
@braders to test this patch, add a function like this to your non-civi api4 entity: public static function getInfo():array {
$info = parent::getInfo();
if (wp is in a separate database) {
$info['database_name'] = 'name_of_wp_db';
}
return $info;
} |
@colemanw I've given this a test, and it seems to work really well 👍. I'll have a think over the next day or so if I can think of any scenarios this doesn't cover, but so far so good. |
@colemanw Ah I see - we installed a view & used that as our table - so Civi is not aware it is looking in a different DB |
Flagging as merge ready given @braders 's feedback |
Overview
Allows Api4 entities to exist in different sql databases from CiviCRM.
Technical Details
To use this, add the following to an Api4 entity file: