• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/access/model/taskregistry.php
  • Класс: Bitrix\Tasks\Access\Model\TaskRegistry
  • Вызов: TaskRegistry::load
public function load($taskIds, bool $withRelations = false): self
{
	if (!is_array($taskIds))
	{
		$taskIds = [$taskIds];
	}

	$taskIds = array_diff($taskIds, array_keys($this->storage));
	if (empty($taskIds))
	{
		return $this;
	}

	foreach ($taskIds as $id)
	{
		$this->storage[$id] = null;
	}

	$res = \Bitrix\Tasks\Internals\TaskTable::query()
		->addSelect('ID')
		->addSelect('GROUP_ID')
		->addSelect('STATUS')
		->addSelect('ALLOW_CHANGE_DEADLINE')
		->addSelect('ALLOW_TIME_TRACKING')
		->addSelect('ZOMBIE')
		->whereIn('ID', $taskIds)
		->exec();

	$foundIds = [];
	while ($row = $res->fetch())
	{
		$foundIds[] = $row['ID'];
		$this->storage[$row['ID']] = $row;
	}

	$this->fillGroups($foundIds);

	if ($withRelations)
	{
		$this->fillFavorites($foundIds);
		$this->fillMembers($foundIds);
	}

	return $this;
}