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