Event::getEntity

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. Event
  4. getEntity
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/core/mappers/event.php
  • Класс: BitrixCalendarCoreMappersEvent
  • Вызов: Event::getEntity
public function getEntity(int $id, ?array $additionalParams = null): ?CoreEventEvent
{
	$eventDM = EventTable::query()
		->where('ID', $id)
	;

	if ($additionalParams)
	{
		//filter
		if (isset($additionalParams['filter'])
			&& is_iterable($additionalParams['filter'])
		)
		{
			foreach ($additionalParams['filter'] as $filter)
			{
				$eventDM->addFilter($filter['key'], $filter['value']);
			}
		}

		//select
		if (isset($additionalParams['fields'])
			&& is_array($additionalParams['fields'])
		)
		{
			$eventDM->setSelect($additionalParams['fields']);
		}
		else
		{
			$eventDM->setSelect(['*']);
		}
	}
	else
	{
		$eventDM->setSelect(['*']);
	}

	$event = $eventDM->exec()->fetchObject();

	return $event
			? (new CoreBuildersEventBuilderFromEntityObject($event))->build()
			: null
	;
}

Добавить комментарий