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

	return array(
		'ID' => array(
			'data_type' => 'integer',
			'primary' => true,
			'autocomplete' => true,
		),
		'OBJECT_ID' => array(
			'data_type' => 'integer',
			'required' => true,
		),
		'OBJECT' => array(
			'data_type' => 'BitrixDiskInternalsObjectTable',
			'reference' => array(
				'=this.OBJECT_ID' => 'ref.ID'
			),
			'join_type' => 'INNER',
		),
		'CREATE_TIME' => array(
			'data_type' => 'datetime',
			'required' => true,
			'default_value' => function() {
				return new DateTime();
			},
		),
		'DEATH_TIME' => array(
			'data_type' => 'datetime',
			'required' => true,
			'default_value' => function() {
				return new DateTime();
			},
		),
		'IS_EXPIRED' => array(
			'data_type' => 'boolean',
			'expression' => array(
				"CASE WHEN (%s IS NOT NULL AND %s > {$now} OR %s IS NULL) THEN 0 ELSE 1 END",
				'DEATH_TIME', 'DEATH_TIME', 'DEATH_TIME'
			),
			'values' => array(0, 1),
		),
	);
}