Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Important
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.24
-
Fix Version/s: 4.7.28
-
Component/s: Drupal Integration Modules
-
Labels:
-
Versioning Impact:Major (incompatible API change)
-
Documentation Required?:Developer Doc
-
Funding Source:Needs Funding
-
Verified?:No
Description
Currently, the way to initialize CiviCRM is to construct the service via:
\Drupal::service('civicrm');
However, service constructors really, traditionally shouldn't have any side-effects - the constructor should just get the object ready to be used. Since a service might need to be constructed just to resolve a dependency, it doesn't necessarily mean any work is actually about to be done with the service.
Instead, I think this should be:
\Drupal::service('civicrm')->initialize();
That way you have to explicitly call a method to cause all the side-effects that is initializing CiviCRM.
This is an API change, but since the Drupal 8 integration module isn't officially released, I think now is the time to make it!
Attachments
Issue Links
- links to