Skip to content

Instantly share code, notes, and snippets.

Created Dec 29, 2015
Embed
What would you like to do?
ORM-класс для работы с таблицей b_site_template, сгенерированный в 1С-Битрикс:Управление сайтом
<?
use Bitrix\Main;
use Bitrix\Main\Localization\Loc;
Loc::loadMessages(__FILE__);
class TemplateTable extends Main\Entity\DataManager
{
public static function getTableName()
{
return 'b_site_template';
}
public static function getMap()
{
return array(
'ID' => array(
'data_type' => 'integer',
'primary' => true,
'autocomplete' => true,
'title' => Loc::getMessage('TEMPLATE_ENTITY_ID_FIELD'),
),
'SITE_ID' => array(
'data_type' => 'string',
'required' => true,
'validation' => array(__CLASS__, 'validateSiteId'),
'title' => Loc::getMessage('TEMPLATE_ENTITY_SITE_ID_FIELD'),
),
'CONDITION' => array(
'data_type' => 'string',
'validation' => array(__CLASS__, 'validateCondition'),
'title' => Loc::getMessage('TEMPLATE_ENTITY_CONDITION_FIELD'),
),
'SORT' => array(
'data_type' => 'integer',
'title' => Loc::getMessage('TEMPLATE_ENTITY_SORT_FIELD'),
),
'TEMPLATE' => array(
'data_type' => 'string',
'required' => true,
'validation' => array(__CLASS__, 'validateTemplate'),
'title' => Loc::getMessage('TEMPLATE_ENTITY_TEMPLATE_FIELD'),
),
);
}
public static function validateSiteId()
{
return array(
new Main\Entity\Validator\Length(null, 2),
);
}
public static function validateCondition()
{
return array(
new Main\Entity\Validator\Length(null, 255),
);
}
public static function validateTemplate()
{
return array(
new Main\Entity\Validator\Length(null, 50),
);
}
}
/////////////////////////////////////////////////////////
$MESS["TEMPLATE_ENTITY_ID_FIELD"] = "";
$MESS["TEMPLATE_ENTITY_SITE_ID_FIELD"] = "";
$MESS["TEMPLATE_ENTITY_CONDITION_FIELD"] = "";
$MESS["TEMPLATE_ENTITY_SORT_FIELD"] = "";
$MESS["TEMPLATE_ENTITY_TEMPLATE_FIELD"] = "";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment