Your IP : 18.118.186.233


Current Path : /home/bitrix/ext_www/www.piano.royal-thermo.com.ua/bitrix/modules/iblock/lib/model/
Upload File :
Current File : /home/bitrix/ext_www/www.piano.royal-thermo.com.ua/bitrix/modules/iblock/lib/model/section.php

<?php
namespace Bitrix\Iblock\Model;

use Bitrix\Iblock;

class Section
{
	private static $entityInstance = array();

	final public static function compileEntityByIblock($iblockId)
	{
		$iblockId = (int)$iblockId;
		if ($iblockId <= 0)
			return null;

		if (!isset(self::$entityInstance[$iblockId]))
		{
			$className = 'Section'.$iblockId.'Table';
			$entityName = "\\Bitrix\\Iblock\\".$className;
			$referenceName = 'Bitrix\Iblock\Section'.$iblockId;
			$entity = '
			namespace Bitrix\Iblock;
			class '.$className.' extends \Bitrix\Iblock\SectionTable
			{
				public static function getUfId()
				{
					return "IBLOCK_'.$iblockId.'_SECTION";
				}
				
				public static function getMap()
				{
					$fields = parent::getMap();
					$fields["PARENT_SECTION"] = array(
						"data_type" => "'.$referenceName.'",
						"reference" => array("=this.IBLOCK_SECTION_ID" => "ref.ID"),
					);
					return $fields;
				}
			}';
			eval($entity);
			self::$entityInstance[$iblockId] = $entityName;
		}

		return self::$entityInstance[$iblockId];
	}
}