Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
factory.php
1<?php
3
5
6class Factory
7{
8 public function getRuleBySharingLink(Link\Joint\JointLink $sharingLink): ?Rule
9 {
10 $linkObjectRule = $this->getLinkObjectRuleByLink($sharingLink);
11
12 if (!is_null($linkObjectRule))
13 {
14 return (new Mapper())->getFromLinkObjectRule($linkObjectRule);
15 }
16
17 return null;
18 }
19
20 public function getLinkObjectRuleByLink(Link\Joint\JointLink $sharingLink): ?LinkObjectRule
21 {
22 if ($sharingLink instanceof Link\CrmDealLink)
23 {
24 return (new Link\Rule\UserCrmDealRule($sharingLink->getOwnerId()))
25 ->setLinkId($sharingLink->getId());
26 }
27
28 if ($sharingLink instanceof Link\UserLink)
29 {
30 return (new Link\Rule\UserRule($sharingLink->getUserId()))
31 ->setLinkId($sharingLink->getId());
32 }
33
34 return null;
35 }
36}