CRM-19813 - CRM_Utils_Hook::container() - Continue using legacy hooks
authorTim Otten <totten@civicrm.org>
Tue, 7 Mar 2017 08:00:03 +0000 (00:00 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 30 Mar 2017 22:39:52 +0000 (15:39 -0700)
CRM/Utils/Hook.php

index aa2f52707c09dc6b98cc3f22c50a2fe821d3f4cd..2636f4527530e727d8345487609c1c7c13c237f7 100644 (file)
@@ -2125,7 +2125,10 @@ abstract class CRM_Utils_Hook {
    * @see http://symfony.com/doc/current/components/dependency_injection/index.html
    */
   public static function container(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
-    self::singleton()->invoke(1, $container, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_container');
+    // This hook fires during system bootstrap, after CRM_Extension_System
+    // initializes but before the container or dispatcher initialize. Therefore,
+    // we cannot use containerized services (like the dispatcher).
+    self::singleton()->invokeViaUF(1, $container, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_container');
   }
 
   /**