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

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

	if ($entry instanceof RegistryEntry)
	{
		$entry->setRegistry($this);
	}

	if ($entry->getPrimaryId())
	{
		parent::offsetSet($entry->getPrimaryId(), $entry);
	}
	else
	{
		$this->newEntityTmpId --;
		parent::offsetSet($this->newEntityTmpId, $entry);
	}

	return $this;
}