/** * Build service. * * Builds event servicehandlers. If the service does not exist, it creates it * and adds it to the DI container. * * @param string $id * @param string $className * @param string $method * * @return Zikula_ServiceHandler */ public function buildService($id, $className, $method) { if (!$this->serviceManager->hasService($id)) { $definition = new Zikula_ServiceManager_Definition($className, array(new Zikula_ServiceManager_Reference($this->serviceId))); $this->serviceManager->registerService($id, $definition); } return new Zikula_ServiceHandler($id, $method); }
/** * Load all persisted services into ServiceManager. * * @return void */ public static function loadPersistentServices() { $handlers = ModUtil::getVar(self::HANDLERS, 'definitions', array()); if (!$handlers) { return; } foreach ($handlers as $id => $handler) { self::$serviceManager->registerService($id, $handler['definition'], $handler['shared']); } }