<?php
namespace Bitrix\View;
use Bitrix\Main\Localization\Loc,
Bitrix\Main\ORM\Data\DataManager,
Bitrix\Main\ORM\Fields\IntegerField,
Bitrix\Main\ORM\Fields\StringField,
Bitrix\Main\ORM\Fields\Validators\LengthValidator;
Loc::loadMessages(__FILE__);
/**
* Class SitemapTable
*
* Fields:
* <ul>
* <li> url string(255) mandatory
* <li> calc_cnt int optional
* </ul>
*
* @package Bitrix\View
**/
class SitemapTable extends DataManager
{
/**
* Returns DB table name for entity.
*
* @return string
*/
public static function getTableName()
{
return 'materialized_view_sitemap';
}
/**
* Returns entity map definition.
*
* @return array
*/
public static function getMap()
{
return [
new StringField(
'url',
[
'primary' => true,
'validation' => [__CLASS__, 'validateUrl'],
'title' => Loc::getMessage('SITEMAP_ENTITY_URL_FIELD')
]
),
new IntegerField(
'calc_cnt',
[
'primary' => true,
'title' => Loc::getMessage('SITEMAP_ENTITY_CALC_CNT_FIELD')
]
),
];
}
/**
* Returns validators for url field.
*
* @return array
*/
public static function validateUrl()
{
return [
new LengthValidator(null, 255),
];
}
}