- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/Relation/RelationManager.php
- Класс: Bitrix\Crm\Relation\RelationManager
- Вызов: RelationManager::mixinPredefinedRelationsForDynamic
protected function mixinPredefinedRelationsForDynamic(array &$predefinedRelations): void
{
$typesMap = Container::getInstance()->getDynamicTypesMap();
$typesMap->load([
'isLoadStages' => false,
'isLoadCategories' => false,
]);
$bindingSettings =
(new Settings())
->setIsPredefined(true)
->setIsChildrenListEnabled(true)
->setRelationType(RelationType::BINDING)
;
foreach ($typesMap->getTypes() as $type)
{
$factory = Container::getInstance()->getDynamicFactoryByType($type);
if ($factory->isPaymentsEnabled())
{
$predefinedRelations[] =
(new Relation(
new RelationIdentifier($type->getEntityTypeId(), \CCrmOwnerType::Order),
clone $bindingSettings
))
->setStorageStrategy(new StorageStrategy\EntityToOrder())
;
}
if (!$type->getIsClientEnabled())
{
continue;
}
$predefinedRelations[] =
(new Relation(
new RelationIdentifier(\CCrmOwnerType::Contact, $type->getEntityTypeId()),
clone $bindingSettings
))
->setStorageStrategy(new StorageStrategy\ContactToFactory($factory))
;
$predefinedRelations[] =
(new Relation(
new RelationIdentifier(\CCrmOwnerType::Company, $type->getEntityTypeId()),
clone $bindingSettings
))
->setStorageStrategy(new StorageStrategy\Factory($factory, Item::FIELD_NAME_COMPANY_ID))
;
}
}