Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
statapp.php
1<?php
2namespace Bitrix\Rest;
3
6Loc::loadMessages(__FILE__);
7
34class StatAppTable extends Main\Entity\DataManager
35{
41 public static function getTableName()
42 {
43 return 'b_rest_stat_app';
44 }
45
51 public static function getMap()
52 {
53 return array(
54 'APP_ID' => array(
55 'data_type' => 'integer',
56 'primary' => true,
57 'title' => Loc::getMessage('STAT_APP_ENTITY_APP_ID_FIELD'),
58 ),
59 'APP_CODE' => array(
60 'data_type' => 'string',
61 'required' => true,
62 'validation' => array(__CLASS__, 'validateAppCode'),
63 'title' => Loc::getMessage('STAT_APP_ENTITY_APP_CODE_FIELD'),
64 ),
65 'APP' => array(
66 'data_type' => 'Bitrix\Rest\App',
67 'reference' => array('=this.APP_ID' => 'ref.ID'),
68 ),
69 );
70 }
76 public static function validateAppCode()
77 {
78 return array(
79 new Main\Entity\Validator\Length(null, 128),
80 );
81 }
87 public static function register($appInfo)
88 {
89 $connection = Main\Application::getConnection();
90 $helper = $connection->getSqlHelper();
91 $queries = $helper->prepareMerge(
92 static::getTableName(),
93 array('APP_ID'),
94 array('APP_ID' => $appInfo['ID'], 'APP_CODE' => $appInfo['CODE']),
95 array('APP_CODE' => $appInfo['CODE'])
96 );
97 foreach($queries as $query)
98 {
99 $connection->queryExecute($query);
100 }
101 }
102}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29