This class is used internally by TApplication to parse and represent application configuration.
С версии: 3.0
Автор: Qiang Xue (qiang.xue@gmail.com)
Автор: Carl G. Mathisen (carlgmathisen@gmail.com)
Наследование: extends TComponent
Пример #1
0
 /**
  * Loads the configuration specific for application part
  * @param TXmlElement config xml element
  * @param string base path corresponding to this xml element
  */
 public function loadApplicationConfigurationFromXml($dom, $configPath)
 {
     $appConfig = new TApplicationConfiguration();
     $appConfig->loadFromXml($dom, $configPath);
     $this->_appConfigs[] = $appConfig;
 }
Пример #2
0
 /**
  * Starts the specified service.
  * The service instance will be created. Its properties will be initialized
  * and the configurations will be applied, if any.
  * @param string service ID
  */
 public function startService($serviceID)
 {
     if (isset($this->_services[$serviceID])) {
         list($serviceClass, $initProperties, $configElement) = $this->_services[$serviceID];
         $service = Prado::createComponent($serviceClass);
         if (!$service instanceof IService) {
             throw new THttpException(500, 'application_service_invalid', $serviceClass);
         }
         if (!$service->getEnabled()) {
             throw new THttpException(500, 'application_service_unavailable', $serviceClass);
         }
         $service->setID($serviceID);
         $this->setService($service);
         foreach ($initProperties as $name => $value) {
             $service->setSubProperty($name, $value);
         }
         if ($configElement !== null) {
             $config = new TApplicationConfiguration();
             if ($this->getConfigurationType() == self::CONFIG_TYPE_PHP) {
                 $config->loadFromPhp($configElement, $this->getBasePath());
             } else {
                 $config->loadFromXml($configElement, $this->getBasePath());
             }
             $this->applyConfiguration($config, true);
         }
         $service->init($configElement);
     } else {
         throw new THttpException(500, 'application_service_unknown', $serviceID);
     }
 }