• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/orm/commonelement.php
  • Класс: BitrixIblockORMCommonElement
  • Вызов: CommonElement::setIblockSectionId
public function setIblockSectionId($iblockSectionId)
{
	$newIblockSectionId = (int) $iblockSectionId;
	$actualIblockSectionId = 0;

	if ($this->state !== State::RAW)
	{
		$this->fill('IBLOCK_SECTION_ID');
		$actualIblockSectionId = $this->remindActual('IBLOCK_SECTION_ID');
	}

	if ($newIblockSectionId !== $actualIblockSectionId)
	{
		// remove old
		if ($actualIblockSectionId > 0)
		{
			$oldSection = SectionTable::wakeUpObject($actualIblockSectionId);
			$this->removeFrom('SECTIONS', $oldSection);
		}

		// add new
		if ($newIblockSectionId > 0)
		{
			$newSection = SectionTable::wakeUpObject($newIblockSectionId);
			$this->addTo('SECTIONS', $newSection);
		}

		// rewrite value
		parent::sysSetValue('IBLOCK_SECTION_ID', $newIblockSectionId);
	}

	return $this;
}