- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/channel/entity/entitychannel.php
- Класс: Bitrix\Crm\Integration\Channel\Entity\EntityChannelTable
- Вызов: EntityChannelTable::bind
static function bind($entityTypeID, $entityID, array $bindings)
{
if(!is_int($entityTypeID))
{
$entityTypeID = (int)$entityTypeID;
}
if($entityTypeID <= 0)
{
throw new Main\ArgumentException('Must be greater than zero', 'entityTypeID');
}
if(!is_int($entityID))
{
$entityID = (int)$entityID;
}
if($entityID <= 0)
{
throw new Main\ArgumentException('Must be greater than zero', 'entityID');
}
$qty = count($bindings);
if($qty === 0)
{
return;
}
for($i = 0; $i < $qty; $i++)
{
$binding = $bindings[$i];
if(!is_array($binding))
{
continue;
}
$typeID = isset($binding['TYPE_ID']) ? (int)$binding['TYPE_ID'] : 0;
if($typeID <= 0)
{
continue;
}
self::upsert(
array(
'ENTITY_TYPE_ID' => $entityTypeID,
'ENTITY_ID' => $entityID,
'TYPE_ID' => $typeID,
'ORIGIN_ID' => isset($binding['ORIGIN_ID']) ? $binding['ORIGIN_ID'] : '',
'COMPONENT_ID' => isset($binding['COMPONENT_ID']) ? $binding['COMPONENT_ID'] : ''
)
);
}
}