if ( $Informationsystem_Controller_Show->group)
{
// Текущая группа
$oInformationsystem_Group = Core_Entity::factory('Informationsystem_Group', $Informationsystem_Controller_Show->group);
// Родительская группа
$oParent_Informationsystem_Group = $oInformationsystem_Group->getParent();
// Родитель не корень
if ($oParent_Informationsystem_Group)
{
// Подгруппы родительской группы
$oSubgroups = $oParent_Informationsystem_Group->Informationsystem_Groups;
$oProperty = Core_Entity::factory('Property', 88);
// Массив значений свойства 123 для информационного элемента $informationsystem_item_id
$aPropertyValues = $oProperty->getValues($Informationsystem_Controller_Show->group);
$oSubgroups->queryBuilder()
->select('informationsystem_groups.*')
->leftJoin('property_value_strings', 'informationsystem_groups.id', '=', 'property_value_strings.entity_id',
array(
array('AND' => array('property_value_strings.property_id', '=', 88))
)
)
// Исключаем текущую группу
->where('informationsystem_groups.id', '!=', $Informationsystem_Controller_Show->group)
->where('property_value_strings.value', '=', $aPropertyValues[0]->value)
->groupBy('informationsystem_groups.id')
// Сортируем случайно
->clearOrderBy()
->orderBy('property_value_strings.value', 'DESC')
// Две группы
->limit(4);
$aSubgroups = $oSubgroups->findAll(FALSE);
if (count($aSubgroups))
{
$oXmlSameGroups = Core::factory('Core_Xml_Entity')->name('sameGroups');
$Informationsystem_Controller_Show->addEntity($oXmlSameGroups);
foreach ($aSubgroups as $oSubgroup)
{
$oTmpGroup = clone $oSubgroup;
$oTmpGroup
->clearEntities()
->clearEntitiesAfterGetXml(FALSE)
->id($oSubgroup->id)
->showXmlProperties(TRUE);
$oXmlSameGroups->addEntity($oTmpGroup);
}
}
}
}
так можно?