Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
restapplang.php
1<?php
3
5
22class RestAppLangTable extends Main\Entity\DataManager
23{
27 public static function getTableName()
28 {
29 return 'b_messageservice_rest_app_lang';
30 }
31
37 public static function getMap()
38 {
39 return array(
40 'ID' => array(
41 'data_type' => 'integer',
42 'primary' => true,
43 'autocomplete' => true
44 ),
45 'APP_ID' => array(
46 'data_type' => 'integer',
47 'required' => true,
48 ),
49 'LANGUAGE_ID' => array(
50 'data_type' => 'string',
51 'required' => true,
52 'validation' => array(__CLASS__, 'validateLanguageId'),
53 ),
54 'NAME' => array(
55 'data_type' => 'string',
56 'required' => true,
57 'validation' => array(__CLASS__, 'validateVarchar500'),
58 ),
59 'APP_NAME' => array(
60 'data_type' => 'string',
61 'validation' => array(__CLASS__, 'validateVarchar500'),
62 ),
63 'DESCRIPTION' => array(
64 'data_type' => 'string',
65 'validation' => array(__CLASS__, 'validateVarchar1000'),
66 ),
67 );
68 }
69
70 public static function deleteByApp($appId)
71 {
72 $connection = Main\Application::getConnection();
73 return $connection->query("DELETE FROM ".static::getTableName()." WHERE APP_ID=".(int)$appId);
74 }
75
79 public static function validateVarchar500()
80 {
81 return array(
82 new Main\Entity\Validator\Length(null, 500),
83 );
84 }
85
91 public static function validateLanguageId()
92 {
93 return array(
94 new Main\Entity\Validator\Length(null, 2),
95 );
96 }
97
101 public static function validateVarchar1000()
102 {
103 return array(
104 new Main\Entity\Validator\Length(null, 1000),
105 );
106 }
107}