Merge pull request #14326 from civicrm/5.14
[civicrm-core.git] / CRM / Core / DAO / Domain.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Domain.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:74b35dfcc8ad2ade69e9bcb75e2f407b)
10 */
11
12 /**
13 * Database access object for the Domain entity.
14 */
15 class CRM_Core_DAO_Domain extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_domain';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * Domain ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Name of Domain / Organization
40 *
41 * @var string
42 */
43 public $name;
44
45 /**
46 * Description of Domain.
47 *
48 * @var string
49 */
50 public $description;
51
52 /**
53 * Backend configuration.
54 *
55 * @var text
56 */
57 public $config_backend;
58
59 /**
60 * The civicrm version this instance is running
61 *
62 * @var string
63 */
64 public $version;
65
66 /**
67 * FK to Contact ID. This is specifically not an FK to avoid circular constraints
68 *
69 * @var int
70 */
71 public $contact_id;
72
73 /**
74 * list of locales supported by the current db state (NULL for single-lang install)
75 *
76 * @var text
77 */
78 public $locales;
79
80 /**
81 * Locale specific string overrides
82 *
83 * @var text
84 */
85 public $locale_custom_strings;
86
87 /**
88 * Class constructor.
89 */
90 public function __construct() {
91 $this->__table = 'civicrm_domain';
92 parent::__construct();
93 }
94
95 /**
96 * Returns foreign keys and entity references.
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
101 public static function getReferenceColumns() {
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
104 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
105 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
106 }
107 return Civi::$statics[__CLASS__]['links'];
108 }
109
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
115 public static function &fields() {
116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
117 Civi::$statics[__CLASS__]['fields'] = [
118 'id' => [
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
121 'title' => ts('Domain ID'),
122 'description' => ts('Domain ID'),
123 'required' => TRUE,
124 'where' => 'civicrm_domain.id',
125 'table_name' => 'civicrm_domain',
126 'entity' => 'Domain',
127 'bao' => 'CRM_Core_BAO_Domain',
128 'localizable' => 0,
129 ],
130 'name' => [
131 'name' => 'name',
132 'type' => CRM_Utils_Type::T_STRING,
133 'title' => ts('Domain Name'),
134 'description' => ts('Name of Domain / Organization'),
135 'maxlength' => 64,
136 'size' => CRM_Utils_Type::BIG,
137 'where' => 'civicrm_domain.name',
138 'table_name' => 'civicrm_domain',
139 'entity' => 'Domain',
140 'bao' => 'CRM_Core_BAO_Domain',
141 'localizable' => 0,
142 'html' => [
143 'type' => 'Text',
144 ],
145 ],
146 'description' => [
147 'name' => 'description',
148 'type' => CRM_Utils_Type::T_STRING,
149 'title' => ts('Domain Description'),
150 'description' => ts('Description of Domain.'),
151 'maxlength' => 255,
152 'size' => CRM_Utils_Type::HUGE,
153 'where' => 'civicrm_domain.description',
154 'table_name' => 'civicrm_domain',
155 'entity' => 'Domain',
156 'bao' => 'CRM_Core_BAO_Domain',
157 'localizable' => 0,
158 'html' => [
159 'type' => 'Text',
160 ],
161 ],
162 'config_backend' => [
163 'name' => 'config_backend',
164 'type' => CRM_Utils_Type::T_TEXT,
165 'title' => ts('Domain Configuration'),
166 'description' => ts('Backend configuration.'),
167 'where' => 'civicrm_domain.config_backend',
168 'table_name' => 'civicrm_domain',
169 'entity' => 'Domain',
170 'bao' => 'CRM_Core_BAO_Domain',
171 'localizable' => 0,
172 'serialize' => self::SERIALIZE_PHP,
173 ],
174 'version' => [
175 'name' => 'version',
176 'type' => CRM_Utils_Type::T_STRING,
177 'title' => ts('CiviCRM Version'),
178 'description' => ts('The civicrm version this instance is running'),
179 'maxlength' => 32,
180 'size' => CRM_Utils_Type::MEDIUM,
181 'where' => 'civicrm_domain.version',
182 'table_name' => 'civicrm_domain',
183 'entity' => 'Domain',
184 'bao' => 'CRM_Core_BAO_Domain',
185 'localizable' => 0,
186 ],
187 'contact_id' => [
188 'name' => 'contact_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Domain Contact'),
191 'description' => ts('FK to Contact ID. This is specifically not an FK to avoid circular constraints'),
192 'where' => 'civicrm_domain.contact_id',
193 'table_name' => 'civicrm_domain',
194 'entity' => 'Domain',
195 'bao' => 'CRM_Core_BAO_Domain',
196 'localizable' => 0,
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
198 ],
199 'locales' => [
200 'name' => 'locales',
201 'type' => CRM_Utils_Type::T_TEXT,
202 'title' => ts('Supported Languages'),
203 'description' => ts('list of locales supported by the current db state (NULL for single-lang install)'),
204 'where' => 'civicrm_domain.locales',
205 'table_name' => 'civicrm_domain',
206 'entity' => 'Domain',
207 'bao' => 'CRM_Core_BAO_Domain',
208 'localizable' => 0,
209 ],
210 'locale_custom_strings' => [
211 'name' => 'locale_custom_strings',
212 'type' => CRM_Utils_Type::T_TEXT,
213 'title' => ts('Language Customizations'),
214 'description' => ts('Locale specific string overrides'),
215 'where' => 'civicrm_domain.locale_custom_strings',
216 'table_name' => 'civicrm_domain',
217 'entity' => 'Domain',
218 'bao' => 'CRM_Core_BAO_Domain',
219 'localizable' => 0,
220 'serialize' => self::SERIALIZE_PHP,
221 ],
222 ];
223 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
224 }
225 return Civi::$statics[__CLASS__]['fields'];
226 }
227
228 /**
229 * Return a mapping from field-name to the corresponding key (as used in fields()).
230 *
231 * @return array
232 * Array(string $name => string $uniqueName).
233 */
234 public static function &fieldKeys() {
235 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
236 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
237 }
238 return Civi::$statics[__CLASS__]['fieldKeys'];
239 }
240
241 /**
242 * Returns the names of this table
243 *
244 * @return string
245 */
246 public static function getTableName() {
247 return self::$_tableName;
248 }
249
250 /**
251 * Returns if this table needs to be logged
252 *
253 * @return bool
254 */
255 public function getLog() {
256 return self::$_log;
257 }
258
259 /**
260 * Returns the list of fields that can be imported
261 *
262 * @param bool $prefix
263 *
264 * @return array
265 */
266 public static function &import($prefix = FALSE) {
267 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'domain', $prefix, []);
268 return $r;
269 }
270
271 /**
272 * Returns the list of fields that can be exported
273 *
274 * @param bool $prefix
275 *
276 * @return array
277 */
278 public static function &export($prefix = FALSE) {
279 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'domain', $prefix, []);
280 return $r;
281 }
282
283 /**
284 * Returns the list of indices
285 *
286 * @param bool $localize
287 *
288 * @return array
289 */
290 public static function indices($localize = TRUE) {
291 $indices = [
292 'UI_name' => [
293 'name' => 'UI_name',
294 'field' => [
295 0 => 'name',
296 ],
297 'localizable' => FALSE,
298 'unique' => TRUE,
299 'sig' => 'civicrm_domain::1::name',
300 ],
301 ];
302 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
303 }
304
305 }