Skip to content

Instantly share code, notes, and snippets.

Created December 29, 2015 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/ece03f45385e4d024862 to your computer and use it in GitHub Desktop.
Save anonymous/ece03f45385e4d024862 to your computer and use it in GitHub Desktop.
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