Problem/Motivation
Error: Class 'CRM_Core_Config_Runtime' not found in Civi\Core\Container::boot() (line 530 of /app/vendor/civicrm/civicrm-core/Civi/Core/Container.php)
#0 /app/vendor/civicrm/civicrm-core/Civi/Core/Container.php(29): Civi\Core\Container::boot(true)
#1 /app/vendor/civicrm/civicrm-core/Civi.php(108): Civi\Core\Container::singleton()
#2 /app/vendor/civicrm/civicrm-core/api/api.php(131): Civi::service('civi_api_kernel')
#3 /app/modules/contrib/civicrm_entity/src/CiviCrmApi.php(81): civicrm_api3('contribution', 'getoptions', Array)
#4 /app/modules/contrib/civicrm_entity/civicrm_entity.module(252): Drupal\civicrm_entity\CiviCrmApi->getOptions('contribution', 'contribution_st...')
Steps to reproduce
1. Enable Civicrm Entity module
2. Go to /admin/structure/civicrm-entity/settings
3. Enable entity types e.g. Contribution
4. Go to admin/structure/civicrm-entity/civicrm-contribution and you will see blank page which is due to the error given above.
Proposed resolution
In modules/contrib/civicrm_entity/src/CiviCrmApi.php
we have initialize() method
/**
* Ensures that CiviCRM is loaded and API function available.
*/
protected function initialize() {
if (!function_exists('civicrm_api3')) {
$this->civicrm->initialize();
}
}when I replace that with
/**
* Ensures that CiviCRM is loaded and API function available.
*/
protected function initialize() {
\Drupal::service('civicrm')->initialize();
}It fixes the error.
Remaining tasks
- If proposed solution is correct , need to add dependency injection code to implement it in OOP's way.
Comments
Comment #2
markusa commentedThis was fixed at some point.