Bitrix\Crm\ItemIdentifier Object
(
[entityTypeId:Bitrix\Crm\ItemIdentifier:private] => 4
[entityId:Bitrix\Crm\ItemIdentifier:private] => 115695
[categoryId:Bitrix\Crm\ItemIdentifier:private] =>
)
$ID['Type'] = $parent->'entityTypeId:Bitrix\Crm\ItemIdentifier:private';
$ID['Type'] = $parent->entityTypeId;
$ID['Type'] = $parent->entityTypeId:Bitrix\Crm\ItemIdentifier:private;
$ID['Type'] = $parent['entityTypeId:Bitrix\Crm\ItemIdentifier:private'];
use Bitrix\Crm\ItemIdentifier;
use Bitrix\Crm\Service\Container;
$leadID = 8939;
$child = new ItemIdentifier(\CCrmOwnerType::Lead, $leadID);
$parents = Container::getInstance()->getRelationManager()->getParentElements($child);
foreach ($parents as $parent) {
echo 'EntityTypeId: ' . $parent->getEntityTypeId() . '<br>';
echo 'EntityId: ' . $parent->getEntityId() . '<br>';
echo 'CategoryId: ' . $parent->getCategoryId() . '<br>';
}
foreach ($parents as $parent) {
$objArr = (array)$parent;
foreach ($objArr as $key => $value) {
$ID[explode("\0",$key)[2]] = $value;
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/cust_app/php_applets_for_bp/logRelRes.txt', print_r($ID, 1));
}
Array
(
[entityTypeId] => 4
[entityId] => 115695
[categoryId] =>
)
Не знаю как красивее сделать, нужна помощь экспертов.