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