Problem
When enabling the extension on CiviCRM 5.75, the following error is thrown:
TypeError: Civi\Schema\EntityRepository::getEntity(): Argument #1 ($entityName)
must be of type string, null given,
called in CRM/Core/DAO/Base.php on line 275
in Civi\Schema\EntityRepository::getEntity()
(line 38 of Civi/Schema/EntityRepository.php)
The extension fails to enable and is left in a broken/partial state.
Root Cause
The extension was generated targeting CiviCRM 6.4+, so civix omitted the mixin polyfill bootstrap with the comment:
// Based on <compatibility>, this does not currently require mixin/polyfill.php.
Without the polyfill, CiviCRM 5.75 does not scan the extension's mixin/ directory for fallback implementations. The bundled mgd-php@2.0.0.mixin.php is never activated, causing the mixin system's state to be incomplete during the enable process.
As a result, EntityRepository is populated before the extension's hook_civicrm_entityTypes listener is registered, so AllCoreTables::getEntityNameForClass() returns null for the extension's DAO classes — which is then passed into EntityRepository::getEntity(null), triggering the TypeError.
Note: mgd-php@2.0.0 was introduced in CiviCRM 6.9 — but the extension already ships it as a bundled fallback. The issue is purely that the polyfill loader is missing, so the bundled file is never used on 5.75.
Fix
Three small changes:
1. info.xml — lower minimum version
- <ver>6.4</ver>
+ <ver>5.75</ver>
2. paymentprocessingcore.civix.php — activate polyfill on older CiviCRM
In _paymentprocessingcore_civix_civicrm_config(), replace the comment with:
if (!class_exists('CRM_Extension_MixInfo')) {
$f = include __DIR__ . '/mixin/polyfill.php';
$f(E::LONG_NAME, E::SHORT_NAME, __DIR__);
}
3. mixin/polyfill.php — add the polyfill file
Copy polyfill.php from CiviCRM core into mixin/polyfill.php.
Reference: https://github.com/civicrm/civicrm-core/blob/5.75.0/mixin/polyfill.php
On CiviCRM 6.4+ this is a complete no-op (CRM_Extension_MixInfo exists, polyfill is skipped).
Impact
- CiviCRM 5.75: extension currently fails to enable ❌
- CiviCRM 6.4+: no impact, fix is a no-op ✅
Problem
When enabling the extension on CiviCRM 5.75, the following error is thrown:
The extension fails to enable and is left in a broken/partial state.
Root Cause
The extension was generated targeting CiviCRM 6.4+, so civix omitted the mixin polyfill bootstrap with the comment:
Without the polyfill, CiviCRM 5.75 does not scan the extension's
mixin/directory for fallback implementations. The bundledmgd-php@2.0.0.mixin.phpis never activated, causing the mixin system's state to be incomplete during the enable process.As a result,
EntityRepositoryis populated before the extension'shook_civicrm_entityTypeslistener is registered, soAllCoreTables::getEntityNameForClass()returnsnullfor the extension's DAO classes — which is then passed intoEntityRepository::getEntity(null), triggering the TypeError.Note:
mgd-php@2.0.0was introduced in CiviCRM 6.9 — but the extension already ships it as a bundled fallback. The issue is purely that the polyfill loader is missing, so the bundled file is never used on 5.75.Fix
Three small changes:
1.
info.xml— lower minimum version2.
paymentprocessingcore.civix.php— activate polyfill on older CiviCRMIn
_paymentprocessingcore_civix_civicrm_config(), replace the comment with:3.
mixin/polyfill.php— add the polyfill fileCopy
polyfill.phpfrom CiviCRM core intomixin/polyfill.php.Reference: https://github.com/civicrm/civicrm-core/blob/5.75.0/mixin/polyfill.php
On CiviCRM 6.4+ this is a complete no-op (
CRM_Extension_MixInfoexists, polyfill is skipped).Impact