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