• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/member/repository/templaterepository.php
  • Класс: BitrixTasksMemberRepositoryTemplateRepository
  • Вызов: TemplateRepository::getEntity
public function getEntity(): TemplateObject|null
{
	if (!is_null($this->template))
	{
		return $this->template;
	}

	global $DB, $USER_FIELD_MANAGER;
	try
	{
		$provider = new TemplateProvider($DB, $USER_FIELD_MANAGER);
		$rows = $provider->getList(arFilter: ['=ID' => $this->templateId], arSelect: ['ID']);
		$templates = [];
		while ($template = $rows->Fetch())
		{
			$templates[]['ID'] = $template['ID'];
		}

		if (empty($templates))
		{
			return null;
		}

		$this->template = new TemplateObject($templates[0]);
	}
	catch (Exception)
	{
		return null;
	}

	$this->template->fillMembers();

	return $this->template;
}