X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FCore%2FContainer.php;h=d1a0578c37923c2fb37a1c6fd9f6b3b75165e308;hb=7c60edb1bf1ca31accfafd35ef0ae02409615e7c;hp=a9923a8fa3a2974f98c3ee5a0ceda93e20771d6e;hpb=82376c1942f709a3c73a5f3f6903603bf7ba0bde;p=civicrm-core.git diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index a9923a8fa3..d1a0578c37 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -13,6 +13,10 @@ use Symfony\Component\DependencyInjection\Reference; // TODO use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +/** + * Class Container + * @package Civi\Core + */ class Container { const SELF = 'civi_container_factory'; @@ -23,10 +27,11 @@ class Container { private static $singleton; /** + * @param bool $reset whether to forcibly rebuild the entire container * @return \Symfony\Component\DependencyInjection\TaggedContainerInterface */ - public static function singleton() { - if (self::$singleton === NULL) { + public static function singleton($reset = FALSE) { + if ($reset || self::$singleton === NULL) { $c = new self(); self::$singleton = $c->createContainer(); } @@ -35,6 +40,7 @@ class Container { /** * @var ContainerBuilder + * @return \Symfony\Component\DependencyInjection\ContainerBuilder */ public function createContainer() { $civicrm_base_path = dirname(dirname(__DIR__)); @@ -83,14 +89,21 @@ class Container { */ public function createEventDispatcher() { $dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher(); + $dispatcher->addListener('hook_civicrm_post::Activity', array('\Civi\CCase\Events', 'fireCaseChange')); + //$dispatcher->addListener('hook_civicrm_post::Case', array('\Civi\CCase\Events', 'fireCaseChange')); + $dispatcher->addListener('hook_civicrm_caseChange', array('\Civi\CCase\Events', 'delegateToXmlListeners')); + $dispatcher->addListener('hook_civicrm_caseChange', array('\Civi\CCase\SequenceListener', 'onCaseChange_static')); return $dispatcher; } /** * @param \Symfony\Component\EventDispatcher\EventDispatcher $dispatcher + * @param $magicFunctionProvider + * * @return \Civi\API\Kernel */ public function createApiKernel($dispatcher, $magicFunctionProvider) { + $dispatcher->addSubscriber(new \Civi\API\Subscriber\ChainSubscriber()); $dispatcher->addSubscriber(new \Civi\API\Subscriber\TransactionSubscriber()); $dispatcher->addSubscriber(new \Civi\API\Subscriber\I18nSubscriber()); $dispatcher->addSubscriber($magicFunctionProvider);