/** * Для сущности со связью RELATION_TYPE_TREE возвращает список всех потомков * * @param EntityORM $oEntity Объект сущности * * @return array */ protected function _GetDescendantsOfEntity($oEntity) { if (in_array(EntityORM::RELATION_TYPE_TREE, $oEntity->_getRelations())) { $aRelationsData = $oEntity->_getRelationsData(); if (array_key_exists('descendants', $aRelationsData)) { $aDescendants = $aRelationsData['descendants']; } else { $aDescendants = array(); if ($aChildren = $oEntity->getChildren()) { $aTree = self::buildTree($aChildren); foreach ($aTree as $aItem) { $aDescendants[] = $aItem['entity']; } } } if (is_array($aDescendants)) { $oEntity->setDescendants($aDescendants); return $aDescendants; } } return false; }