• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Collection.php
  • Класс: BitrixImV2Collection
  • Вызов: Collection::offsetSet
public function offsetSet($offset, $entry): void
{
	$collectionElementClass = static::getCollectionElementClass();

	if (!($entry instanceof $collectionElementClass))
	{
		$entryClass = get_class($entry);
		throw new ArgumentTypeException("Entry is instance of {$entryClass}, but collection support {$collectionElementClass}");
	}

	if ($offset === null)
	{
		if ($entry->getPrimaryId())
		{
			$offset = $entry->getPrimaryId();
		}
		else
		{
			$this->newEntityTmpId --;
			$offset = $this->newEntityTmpId;
		}
	}

	parent::offsetSet($offset, $entry);
}