TimelineEntry
CRUD operations with timeline events are executed via \Bitrix\Crm\TimelineEntry
. Each type of event has its own descendant, implementing the method create
. This specific method is used for adding new events.
Service \Bitrix\Crm\TimelineEntry\Facade
was designed for creating various types of events via unified entry point within [link=13967440]SPA[/link] timeline. This service simplifies code testing and gives an opportunity to mockup a desired behaviour.
Internal composition
important! This block was written specifically for informational purposes only. Please, do not use provided table explicitly. By doing so, you disturb encapsulation and complicate code maintenance!
Timeline event data is stored in three tables:
-
b_crm_timeline (
\Bitrix\Crm\Timeline\Entity\TimelineTable
) - stores main data portion (event type, author, description and etc.).Fields
ASSOCIATED_ENTITY_TYPE_ID
andASSOCIATED_ENTITY_ID
describe, which element is described in the event. If element was created or updated, indicates this element. If an Activity was created, indicates this activity.The field
TYPE_ID
indicates an event type. Stores class constants\Bitrix\Crm\Timeline\TimelineType
. Usually, each type of event has its own constant. However, several events can have the same value. For example, many types of "activities" have the sameTYPE_ID = TimelineType::ACTIVITY
. -
b_crm_timeline_bind (
\Bitrix\Crm\Timeline\Entity\TimelineBindingTable
) - stores data on which entity timelines must show the event. Has association as "single to multiple" withb_crm_timeline
. Accordingly, the same event can be displayed in several timelines simultaneously. -
b_crm_timeline_search (
\Bitrix\Crm\Timeline\Entity\TimelineSearchTable
) - stores full-text index for searching by events.
When events are selected in the component crm.timeline
to be rendered in element timeline with specific entityTypeId
and entityId
, filters by b_crm_timeline_bind.ENTITY_TYPE_ID = entityTypeId AND b_crm_timeline_bind.ENTITY_ID = entityId
. All events, processed via this filter are displayed in the interface.