1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00

Inheritance + ORM fixes

This commit is contained in:
Alexander Zinchuk 2010-11-18 17:09:22 +00:00
parent 7bf7511880
commit fe8529f8f2
2 changed files with 18 additions and 5 deletions

View file

@ -676,10 +676,20 @@ class Engine extends Object {
: 'Module'.$sModule.'_Entity'.$sEntity;
/**
* If plugin Entity doesn't exist, maybe the default one does?
* If Plugin Entity doesn't exist, search among it's Module delegates
*/
if(isset($sPlugin) && !self::GetClassPath($sClass)) {
$sClass = 'Module'.$sModule.'_Entity'.$sEntity;
$aModulesChain = Engine::GetInstance()->Plugin_GetDelegationChain('module','Plugin'.$sPlugin.'_Module'.$sModule);
foreach($aModulesChain as $sModuleName) {
$sClassTest=$sModuleName.'_Entity'.$sEntity;
if(self::GetClassPath($sClassTest)) {
$sClass=$sClassTest;
break;
}
}
if(!self::GetClassPath($sClass)) {
$sClass='Module'.$sModule.'_Entity'.$sEntity;
}
}
/**

View file

@ -154,9 +154,12 @@ abstract class EntityORM extends Entity {
$sModuleName=Engine::GetModuleName($this);
$sEntityName=Engine::GetEntityName($this);
$sPluginPrefix=Engine::GetPluginPrefix($this);
if(!class_exists($sPluginPrefix.$sModuleName) && $oRootDelegater=$this->Plugin_GetRootDelegater('entity',get_class($this))) {
$sModuleName=Engine::GetModuleName($oRootDelegater);
$sPluginPrefix=Engine::GetPluginPrefix($oRootDelegater);
/**
* If Module not exists, try to find its root Delegater
*/
if(!Engine::GetClassPath($sPluginPrefix.$sModuleName) && $oModuleRootDelegater=$this->Plugin_GetRootDelegater('module',$sPluginPrefix.$sModuleName)) {
$sModuleName=Engine::GetModuleName($oModuleRootDelegater);
$sPluginPrefix=Engine::GetPluginPrefix($oModuleRootDelegater);
}
return Engine::GetInstance()->_CallModule("{$sPluginPrefix}{$sModuleName}_{$sName}{$sEntityName}",array($this));
}