/** * Для сущности со связью RELATION_TYPE_TREE возвращает список прямых потомков * * @param EntityORM $oEntity Объект сущности * @return array */ protected function _GetChildrenOfEntity($oEntity) { if ($oEntity->_isUsedRelationType(EntityORM::RELATION_TYPE_TREE)) { $aRelationsData = $oEntity->_getRelationsData(); if (array_key_exists('children', $aRelationsData)) { $aChildren = $aRelationsData['children']; } else { $aChildren = array(); if ($sPrimaryKey = $oEntity->_getPrimaryKey()) { if ($sPrimaryKeyValue = $oEntity->_getDataOne($sPrimaryKey)) { $aChildren = $this->GetItemsByFilter(array($oEntity->_getTreeParentKey() => $sPrimaryKeyValue), Engine::GetEntityName($oEntity)); } } } if (is_array($aChildren)) { $oEntity->setChildren($aChildren); return $aChildren; } } return false; }