1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
RelationProvider.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Relation;
4
5use Bitrix\Calendar\Core\Event\Event;
6use Bitrix\Calendar\Core\Mappers;
7use Bitrix\Calendar\Relation\Exception\RelationException;
8use Bitrix\Calendar\Relation\Result\RelationResult;
9use Bitrix\Calendar\Relation\Strategy;
10use Bitrix\Main\Error;
11
13{
14 public function getEventRelation(int $userId, int $eventId): RelationResult
15 {
16 $result = new RelationResult();
17
19 $event = (new Mappers\Event())->getById($eventId);
20 if (!$event)
21 {
22 $result->addError(new Error('Event not found'));
23
24 return $result;
25 }
26
27 $strategy = Strategy\Factory::getInstance()->getStrategy($userId, $event);
28
29 try
30 {
31 $result->setRelation($strategy->getRelation());
32 }
33 catch (RelationException $exception)
34 {
35 $result->addError(Error::createFromThrowable($exception));
36 }
37
38 return $result;
39 }
40}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
Определения error.php:15
$result
Определения get_property_values.php:14
$event
Определения prolog_after.php:141