• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/internals/showsession.php
  • Класс: BitrixDiskInternalsShowSessionTable
  • Вызов: ShowSessionTable::getMap
static function getMap()
{
	$sqlHelper = Application::getConnection()->getSqlHelper();

	$deathTime = $sqlHelper->addSecondsToDateTime(self::LIFETIME_SECONDS, 'CREATE_TIME');
	$now = $sqlHelper->getCurrentDateTimeFunction();

	return array(
		'ID' => array(
			'data_type' => 'integer',
			'primary' => true,
			'autocomplete' => true,
		),
		'OBJECT_ID' => array(
			'data_type' => 'integer',
		),
		'OBJECT' => array(
			'data_type' => 'BitrixDiskInternalsFileTable',
			'reference' => array(
				'=this.OBJECT_ID' => 'ref.ID'
			),
		),
		'VERSION_ID' => array(
			'data_type' => 'integer',
		),
		'VERSION' => array(
			'data_type' => 'BitrixDiskInternalsVersionTable',
			'reference' => array(
				'=this.OBJECT_ID' => 'ref.ID'
			),
		),
		'USER_ID' => array(
			'data_type' => 'integer',
			'required' => true,
		),
		'OWNER_ID' => array(
			'data_type' => 'integer',
			'required' => true,
		),
		'SERVICE' => array(
			'data_type' => 'string',
			'required' => true,
			'validation' => array(__CLASS__, 'validateService'),
		),
		'SERVICE_FILE_ID' => array(
			'data_type' => 'string',
			'required' => true,
			'validation' => array(__CLASS__, 'validateServiceFileId'),
		),
		'SERVICE_FILE_LINK' => array(
			'data_type' => 'text',
			'required' => true,
		),
		'ETAG' => array(
			'data_type' => 'string',
			'required' => true,
			'validation' => array(__CLASS__, 'validateEtag'),
		),
		'IS_EXPIRED' => array(
			'data_type' => 'boolean',
			'expression' => array(
				"CASE WHEN ({$now} > {$deathTime}) THEN 1 ELSE 0 END"
			),
			'values' => array(0, 1),
		),
		'CREATE_TIME' => array(
			'data_type' => 'datetime',
			'required' => true,
			'default_value' => function() {
				return new DateTime();
			},
		),
	);
}