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.

User interface changes

API changes

Data model changes

Comments

hash6 created an issue. See original summary.

markusa’s picture

Status: Needs work » Fixed

This was fixed at some point.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.