Comment::find

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Comment
  4. find
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/tasks/comment.php
  • Класс: Bitrix\Crm\Activity\Provider\Tasks\Comment
  • Вызов: Comment::find
public function find(int $taskId, ItemIdentifier $identifier): ?EO_Activity
{
	if ($taskId <= 0)
	{
		return null;

	}

	$key = $this->getCacheKey($taskId);
	if (isset(self::$cache[$key]))
	{
		return self::$cache[$key];
	}

	$task = TaskObject::getObject($taskId);
	if (is_null($task))
	{
		return null;
	}

	try
	{
		$query = ActivityTable::query();
		$query
			->addSelect('ID')
			->addSelect('TYPE_ID')
			->addSelect('PROVIDER_ID')
			->addSelect('PROVIDER_TYPE_ID')
			->addSelect('COMPLETED')
			->addSelect('RESPONSIBLE_ID')
			->addSelect('SETTINGS')
			->addSelect('STORAGE_TYPE_ID')
			->addSelect('STORAGE_ELEMENT_IDS')
			->where('ASSOCIATED_ENTITY_ID', $taskId)
			->where('PROVIDER_ID', self::getId())
			->where('OWNER_ID', $identifier->getEntityId())
			->where('OWNER_TYPE_ID', $identifier->getEntityTypeId())
		;

		self::$cache[$key] = $query->exec()->fetchObject();
	}
	catch (SystemException $exception)
	{
		return null;
	}

	return self::$cache[$key];
}

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