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

Fixes for _GetDescendantsOfEntity and _GetAncestorsOfEntity

This commit is contained in:
Alexander Zinchuk 2010-11-09 01:48:36 +00:00
parent 4fc990a06a
commit d21dacda65

View file

@ -141,11 +141,10 @@ abstract class ModuleORM extends Module {
$aAncestors=$aRelationsData['ancestors']; $aAncestors=$aRelationsData['ancestors'];
} else { } else {
$aAncestors=array(); $aAncestors=array();
$sParentId=$oEntity->getParentId(); $oEntityParent=$oEntity->getParent();
while($sParentId > 0) { while(is_object($oEntityParent)) {
$oEntity=$oEntity->getParent(); $aAncestors[]=$oEntityParent;
$aAncestors[]=$oEntity; $oEntityParent=$oEntityParent->getParent();
$sParentId=$oEntity->getParentId();
} }
} }
if(is_array($aAncestors)) { if(is_array($aAncestors)) {
@ -165,7 +164,6 @@ abstract class ModuleORM extends Module {
} else { } else {
$aDescendants=array(); $aDescendants=array();
if($aChildren=$oEntity->getChildren()) { if($aChildren=$oEntity->getChildren()) {
$aDescendants=$aChildren;
$aTree=self::buildTree($aChildren); $aTree=self::buildTree($aChildren);
foreach($aTree as $aItem) { foreach($aTree as $aItem) {
$aDescendants[] = $aItem['entity']; $aDescendants[] = $aItem['entity'];