1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
CrmSharingStrategy.php
См. документацию.
1<?php
2
4
13use Bitrix\Crm\EO_Deal;
14
16{
20 public function getRelation(): Relation
21 {
22 $relation = new Relation($this->event->getId());
24 $eventLink = Sharing\Link\Factory::getInstance()->getEventLinkByEventId($this->event->getId(), false);
25 if (!$eventLink)
26 {
27 throw new RelationException('Event sharing link not found');
28 }
29
31 $crmDealLink = Sharing\Link\Factory::getInstance()->getLinkByHash($eventLink->getParentLinkHash());
32 if (!$crmDealLink)
33 {
34 throw new RelationException('Deal sharing link not found');
35 }
36
38 $deal = DealHandler::getDeal($crmDealLink->getEntityId());
39 if (!$deal)
40 {
41 throw new RelationException('Deal not found');
42 }
43
44 $entity = (new EntityBuilderFromDeal($deal))->build();
45 $relation->setEntity($entity);
46
47 $owner = (new OwnerBuilder($deal->getAssignedById()))->build();
48 $relation->setOwner($owner);
49
50 return $relation;
51 }
52}
$entity