Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/calendar/lib/Relation/ |
Upload File : |
<?php namespace Bitrix\Calendar\Relation; use Bitrix\Calendar\Core\Event\Event; use Bitrix\Calendar\Core\Mappers; use Bitrix\Calendar\Relation\Exception\RelationException; use Bitrix\Calendar\Relation\Result\RelationResult; use Bitrix\Calendar\Relation\Strategy; use Bitrix\Main\Error; class RelationProvider { public function getEventRelation(int $userId, int $eventId): RelationResult { $result = new RelationResult(); /** @var Event $event */ $event = (new Mappers\Event())->getById($eventId); if (!$event) { $result->addError(new Error('Event not found')); return $result; } $strategy = Strategy\Factory::getInstance()->getStrategy($userId, $event); try { $result->setRelation($strategy->getRelation()); } catch (RelationException $exception) { $result->addError(Error::createFromThrowable($exception)); } return $result; } }