Merge pull request #13158 from elisseck/dev/core/544
[civicrm-core.git] / CRM / Core / DAO / Persistent.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Persistent.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0c52f813dd1e954e1709b819128790f3)
10 */
11
12 /**
13 * Database access object for the Persistent entity.
14 */
15 class CRM_Core_DAO_Persistent extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_persistent';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = FALSE;
30
31 /**
32 * Persistent Record Id
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Context for which name data pair is to be stored
40 *
41 * @var string
42 */
43 public $context;
44
45 /**
46 * Name of Context
47 *
48 * @var string
49 */
50 public $name;
51
52 /**
53 * data associated with name
54 *
55 * @var longtext
56 */
57 public $data;
58
59 /**
60 * Config Settings
61 *
62 * @var boolean
63 */
64 public $is_config;
65
66 /**
67 * Class constructor.
68 */
69 public function __construct() {
70 $this->__table = 'civicrm_persistent';
71 parent::__construct();
72 }
73
74 /**
75 * Returns all the column names of this table
76 *
77 * @return array
78 */
79 public static function &fields() {
80 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
81 Civi::$statics[__CLASS__]['fields'] = [
82 'id' => [
83 'name' => 'id',
84 'type' => CRM_Utils_Type::T_INT,
85 'title' => ts('Persistent ID'),
86 'description' => ts('Persistent Record Id'),
87 'required' => TRUE,
88 'table_name' => 'civicrm_persistent',
89 'entity' => 'Persistent',
90 'bao' => 'CRM_Core_BAO_Persistent',
91 'localizable' => 0,
92 ],
93 'context' => [
94 'name' => 'context',
95 'type' => CRM_Utils_Type::T_STRING,
96 'title' => ts('Context'),
97 'description' => ts('Context for which name data pair is to be stored'),
98 'required' => TRUE,
99 'maxlength' => 255,
100 'size' => CRM_Utils_Type::HUGE,
101 'table_name' => 'civicrm_persistent',
102 'entity' => 'Persistent',
103 'bao' => 'CRM_Core_BAO_Persistent',
104 'localizable' => 0,
105 ],
106 'name' => [
107 'name' => 'name',
108 'type' => CRM_Utils_Type::T_STRING,
109 'title' => ts('Name'),
110 'description' => ts('Name of Context'),
111 'required' => TRUE,
112 'maxlength' => 255,
113 'size' => CRM_Utils_Type::HUGE,
114 'table_name' => 'civicrm_persistent',
115 'entity' => 'Persistent',
116 'bao' => 'CRM_Core_BAO_Persistent',
117 'localizable' => 0,
118 ],
119 'data' => [
120 'name' => 'data',
121 'type' => CRM_Utils_Type::T_LONGTEXT,
122 'title' => ts('Data'),
123 'description' => ts('data associated with name'),
124 'table_name' => 'civicrm_persistent',
125 'entity' => 'Persistent',
126 'bao' => 'CRM_Core_BAO_Persistent',
127 'localizable' => 0,
128 ],
129 'is_config' => [
130 'name' => 'is_config',
131 'type' => CRM_Utils_Type::T_BOOLEAN,
132 'title' => ts('Is Configuration?'),
133 'description' => ts('Config Settings'),
134 'required' => TRUE,
135 'default' => '0',
136 'table_name' => 'civicrm_persistent',
137 'entity' => 'Persistent',
138 'bao' => 'CRM_Core_BAO_Persistent',
139 'localizable' => 0,
140 ],
141 ];
142 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
143 }
144 return Civi::$statics[__CLASS__]['fields'];
145 }
146
147 /**
148 * Return a mapping from field-name to the corresponding key (as used in fields()).
149 *
150 * @return array
151 * Array(string $name => string $uniqueName).
152 */
153 public static function &fieldKeys() {
154 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
155 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
156 }
157 return Civi::$statics[__CLASS__]['fieldKeys'];
158 }
159
160 /**
161 * Returns the names of this table
162 *
163 * @return string
164 */
165 public static function getTableName() {
166 return self::$_tableName;
167 }
168
169 /**
170 * Returns if this table needs to be logged
171 *
172 * @return bool
173 */
174 public function getLog() {
175 return self::$_log;
176 }
177
178 /**
179 * Returns the list of fields that can be imported
180 *
181 * @param bool $prefix
182 *
183 * @return array
184 */
185 public static function &import($prefix = FALSE) {
186 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'persistent', $prefix, []);
187 return $r;
188 }
189
190 /**
191 * Returns the list of fields that can be exported
192 *
193 * @param bool $prefix
194 *
195 * @return array
196 */
197 public static function &export($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'persistent', $prefix, []);
199 return $r;
200 }
201
202 /**
203 * Returns the list of indices
204 *
205 * @param bool $localize
206 *
207 * @return array
208 */
209 public static function indices($localize = TRUE) {
210 $indices = [];
211 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
212 }
213
214 }