Backport: add mixin polyfill to support CiviCRM 5.75+#21
Conversation
The extension was originally generated targeting CiviCRM 6.4+, which caused civix to omit the mixin polyfill bootstrap. As a result, on CiviCRM 5.75 the bundled mgd-php@2.0.0.mixin.php was never activated, leading to a TypeError during extension enable: TypeError: Civi\Schema\EntityRepository::getEntity(): Argument #1 ($entityName) must be of type string, null given Root cause: without the polyfill, CiviCRM 5.75 does not scan the extension's mixin/ directory for fallback implementations. The entity registry is populated before the extension's hook_civicrm_entityTypes listener is registered, so getEntityNameForClass() returns null for the extension's DAO classes. Changes: - info.xml: lower minimum compatibility to 5.75 - paymentprocessingcore.civix.php: activate polyfill when CRM_Extension_MixInfo is absent (i.e. CiviCRM < ~5.77 without native mixin support) - mixin/polyfill.php: add the polyfill file from CiviCRM core 5.75 On CiviCRM 6.4+ this is a no-op (CRM_Extension_MixInfo exists, polyfill skipped).
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a mixin polyfill to resolve a TypeError encountered when enabling the extension on CiviCRM 5.75. By backporting the necessary bootstrap logic, the extension can now correctly register entities on older CiviCRM versions while maintaining existing functionality for 6.4+ environments. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enables backport support for CiviCRM 5.75+ by adjusting the version compatibility in info.xml and adding a polyfill for mixin services. Feedback was provided regarding the PR title and commit message, which need to be updated to follow the mandatory 'CIVIMM-###:' naming convention defined in the style guide.
| <develStage>alpha</develStage> | ||
| <compatibility> | ||
| <ver>6.4</ver> | ||
| <ver>5.75</ver> |
There was a problem hiding this comment.
WARNING: The PR title (and likely the commit message) does not follow the required format CIVIMM-###:. Please update it to include the relevant ticket number (e.g., CIVIMM-20: Backport: add mixin polyfill to support CiviCRM 5.75+) as per the repository style guide (rule 25).
References
- Commit messages must follow the CIVIMM-###: format (Rule 25). (link)
erawat
left a comment
There was a problem hiding this comment.
PR created byt openclawns, tested with deploy site, approved and merge for 5.75+ complatibiltiy.
Closes #20
Summary
Adds mixin polyfill support so the extension works on CiviCRM 5.75+ as well as 6.4+.
Problem
On CiviCRM 5.75, enabling the extension throws:
The extension was generated targeting CiviCRM 6.4+, so civix omitted the mixin polyfill bootstrap. Without it, the bundled
mgd-php@2.0.0.mixin.phpis never activated on 5.75, leaving entity registration incomplete during enable — causinggetEntityNameForClass()to returnnull→ TypeError.Changes
info.xml6.4→5.75paymentprocessingcore.civix.php_paymentprocessingcore_civix_civicrm_config():CRM_Extension_MixInfoexists)mixin/polyfill.php(new file)Compatibility
Notes
civix upgradeafter updatinginfo.xmlto<ver>5.75</ver>— that will regeneratecivix.phpcorrectly so future upgrades don't regress. See Backport: add mixin polyfill to support CiviCRM 5.75+ #20 for full details.mgd-php@2.0.0mixin was already bundled in the extension — this PR just ensures it gets activated on 5.75.