• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/location.php
  • Класс: Bitrix\Sale\Location\LocationTable
  • Вызов: LocationTable::getMap
static function getMap()
{
	return array(

		'ID' => array(
			'data_type' => 'integer',
			'primary' => true,
			'autocomplete' => true,
			'title' => 'ID'
		),
		'CODE' => array(
			'data_type' => 'string',
			'title' => Loc::getMessage('SALE_LOCATION_LOCATION_ENTITY_CODE_FIELD'),
			'required' => true,
			'validation' => array(__CLASS__, 'getCodeValidators')
		),

		'LEFT_MARGIN' => array(
			'data_type' => 'integer',
		),
		'RIGHT_MARGIN' => array(
			'data_type' => 'integer',
		),
		'DEPTH_LEVEL' => array(
			'data_type' => 'integer',
		),
		'SORT' => array(
			'data_type' => 'integer',
			'default_value' => 100,
			'title' => Loc::getMessage('SALE_LOCATION_LOCATION_ENTITY_SORT_FIELD')
		),
		'PARENT_ID' => array(
			'data_type' => 'integer',
			'default_value' => 0,
			'title' => Loc::getMessage('SALE_LOCATION_LOCATION_ENTITY_PARENT_ID_FIELD')
		),
		'TYPE_ID' => array(
			'data_type' => 'integer',
			'required' => true,
			'title' => Loc::getMessage('SALE_LOCATION_LOCATION_ENTITY_TYPE_ID_FIELD')
		),
		'LATITUDE' => array(
			'data_type' => 'float',
			'title' => Loc::getMessage('SALE_LOCATION_LOCATION_ENTITY_LATITUDE_FIELD')
		),
		'LONGITUDE' => array(
			'data_type' => 'float',
			'title' => Loc::getMessage('SALE_LOCATION_LOCATION_ENTITY_LONGITUDE_FIELD')
		),

		// virtual
		'TYPE' => array(
			'data_type' => 'Bitrix\Sale\Location\Type',
			'reference' => array(
				'=this.TYPE_ID' => 'ref.ID'
			),
			'join_type' => "inner"
		),
		'NAME' => array(
			'data_type' => 'Bitrix\Sale\Location\Name\Location',
			'reference' => array(
				'=this.ID' => 'ref.LOCATION_ID'
			),
			'join_type' => "inner"
		),
		'PARENT' => array(
			'data_type' => 'Bitrix\Sale\Location\Location',
			'reference' => array(
				'=this.PARENT_ID' => 'ref.ID'
			)
		),
		'PARENTS' => array(
			'data_type' => 'Bitrix\Sale\Location\Location',
			'reference' => array(
				'<=ref.LEFT_MARGIN' => 'this.LEFT_MARGIN',
				'>=ref.RIGHT_MARGIN' => 'this.RIGHT_MARGIN'
			)
		),
		'CHILDREN' => array(
			'data_type' => 'Bitrix\Sale\Location\Location',
			'reference' => array(
				'=this.ID' => 'ref.PARENT_ID'
			)
		),
		'EXTERNAL' => array(
			'data_type' => 'Bitrix\Sale\Location\External',
			'reference' => array(
				'=this.ID' => 'ref.LOCATION_ID'
			)
		),
		'DEFAULT_SITE' => array(
			'data_type' => 'Bitrix\Sale\Location\DefaultSite',
			'reference' => array(
				'=this.CODE' => 'ref.LOCATION_CODE'
			)
		),

		'CNT' => array(
			'data_type' => 'integer',
			'expression' => array(
				'count(*)'
			)
		),
		'CHILDREN_CNT' => array(
			'data_type' => 'integer',
			'expression' => array(
				'count(%s)', 
				'CHILD.ID'
			)
		),
		'IS_PARENT' => array(
			'data_type' => 'boolean',
			'expression' => array(
				'case when count(%s) > 0 then 1 else 0 end',
				'CHILD.ID'
			)
		),

		// do not remove unless you want migrator to be dead
		'COUNTRY_ID' => array(
			'data_type' => 'integer',
		),
		'REGION_ID' => array(
			'data_type' => 'integer',
		),
		'CITY_ID' => array(
			'data_type' => 'integer',
		),
		'LOC_DEFAULT' => array(
			'data_type' => 'string',
		),

		// deprecated aliases
		'CHILD' => array(
			'data_type' => 'Bitrix\Sale\Location\Location',
			'reference' => array(
				'=this.ID' => 'ref.PARENT_ID'
			)
		),
		'CHILD_CNT' => array(
			'data_type' => 'integer',
			'expression' => array(
				'count(%s)', 
				'CHILD.ID'
			)
		),
		'DEFAULT_SORT' => array(
			'data_type' => 'Bitrix\Sale\Location\DefaultSiteTable',
			'reference' => array(
				'=this.CODE' => 'ref.LOCATION_CODE'
			)
		),

	);
}