diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/TApplication.php | 18 | ||||
-rw-r--r-- | framework/Web/Services/TPageService.php | 26 |
2 files changed, 14 insertions, 30 deletions
diff --git a/framework/TApplication.php b/framework/TApplication.php index 2f25925d..8c4f65f0 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -824,7 +824,8 @@ class TApplication extends TComponent Prado::trace("Loading module $id ({$moduleConfig[0]})",'System.TApplication'); $module=Prado::createComponent($moduleConfig[0]); - $this->setModule($id,$module); + if(is_string($id)) + $this->setModule($id,$module); foreach($moduleConfig[1] as $name=>$value) $module->setSubProperty($name,$value); $module->init($moduleConfig[2]); @@ -1087,14 +1088,15 @@ class TApplicationConfiguration extends TComponent foreach($modulesNode->getElementsByTagName('module') as $node) { $properties=$node->getAttributes(); - if(($id=$properties->itemAt('id'))===null) - throw new TConfigurationException('appconfig_moduleid_required'); - if(($type=$properties->remove('class'))===null && isset($this->_modules[$id]) && $this->_modules[$id][2]===null) - $type=$this->_modules[$id][0]; + $id=$properties->itemAt('id'); + $type=$properties->remove('class'); if($type===null) throw new TConfigurationException('appconfig_moduletype_required',$id); $node->setParent(null); - $this->_modules[$id]=array($type,$properties->toArray(),$node); + if($id===null) + $this->_modules[]=array($type,$properties->toArray(),$node); + else + $this->_modules[$id]=array($type,$properties->toArray(),$node); } } @@ -1106,9 +1108,7 @@ class TApplicationConfiguration extends TComponent $properties=$node->getAttributes(); if(($id=$properties->itemAt('id'))===null) throw new TConfigurationException('appconfig_serviceid_required'); - if(($type=$properties->remove('class'))===null && isset($this->_services[$id]) && $this->_services[$id][2]===null) - $type=$this->_services[$id][0]; - if($type===null) + if(($type=$properties->remove('class'))===null) throw new TConfigurationException('appconfig_servicetype_required',$id); $node->setParent(null); $this->_services[$id]=array($type,$properties->toArray(),$node); diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index ad1320b3..988f665a 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -696,30 +696,14 @@ class TPageConfiguration extends TComponent {
$properties=$node->getAttributes();
$type=$properties->remove('class');
- if(($id=$properties->itemAt('id'))===null)
- throw new TConfigurationException('pageserviceconf_module_invalid',$configPath);
- if(isset($this->_modules[$id]))
- {
- if($type===null || $type===$this->_modules[$id][0])
- {
- $this->_modules[$id][1]=array_merge($this->_modules[$id][1],$properties->toArray());
- $elements=$this->_modules[$id][2]->getElements();
- foreach($node->getElements() as $element)
- $elements->add($element);
- }
- else
- {
- $node->setParent(null);
- $this->_modules[$id]=array($type,$properties->toArray(),$node);
- }
- }
- else if($type===null)
+ $id=$properties->itemAt('id');
+ if($type===null)
throw new TConfigurationException('pageserviceconf_moduletype_required',$id,$configPath);
+ $node->setParent(null);
+ if($id===null)
+ $this->_modules[]=array($type,$properties->toArray(),$node);
else
- {
- $node->setParent(null);
$this->_modules[$id]=array($type,$properties->toArray(),$node);
- }
}
}
|