Documentation

Composite Identifiers

\Bitrix\Crm\ItemIdentifier and \Bitrix\Crm\RelationIdentifier store data used for identification. In case of ItemIdentifier its a specific item of an entity (for example, specific deal with ID = 74). And in case of RelationIdentifier - specific binding type.

Objects for both classes are value objects and are immutable. Their parameter values are passed in __construct and cannot be re-set later. Changing any value requires a new object created based on the old object.

When creating objects of both classes data is validated.

Both classes are available starting from the crm 20.700.0. Do not forget to set a corresponding dependency!



ItemIdentifier

Object ItemIdentifier stores entityTypeId and entityId that can be used to identify an item

Constructor has the following signature:


__construct(int $entityTypeId, int $entityId)
  • entityTypeId - \CCrmOwnerType constant, for example \CCrmOwnerType::Lead. Value must match to the actually existing entity type (\CCrmOwnerType::IsDefined). Otherwise, throws an exception.
  • entityId - item ID. For example, specific deal ID. Must be higher than 0, otherwise throws an exception.

The object can also be created based on \Bitrxi\Crm\Item using the method \Bitrix\Crm\ItemIdentifier::createByItem.



RelationIdentifier

Object RelationIdentifier stores parentEntityTypeId and childEntityTypeId used to identify [link=13962588]тип связи[/link].

Constructor has the following signature:


__construct(int $parentEntityTypeId, int $childEntityTypeId)
  • parentEntityTypeId - constant of \CCrmOwnerType, for example \CCrmOwnerType::Lead. Specifies, which entity type is a parent entity in this binding. Value must be higher than "0", otherwise throws an exception.
  • childEntityTypeId - similar to parentEntityTypeId. Indicates entity type тип сущности является потомком в данной связи. It must be higher than "0", otherwise throws an exception.


© «Bitrix24», 2001-2024