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 | |
00178bf2 | 9 | * (GenCodeChecksum:cdd41aa071b68a8a4be6b28f7ca3a0a3) |
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 { |
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 | * The civicrm version this instance is running | |
54 | * | |
55 | * @var string | |
56 | */ | |
57 | public $version; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * FK to Contact ID. This is specifically not an FK to avoid circular constraints | |
61 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
63 | */ |
64 | public $contact_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * list of locales supported by the current db state (NULL for single-lang install) | |
68 | * | |
69 | * @var text | |
70 | */ | |
71 | public $locales; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * Locale specific string overrides | |
75 | * | |
76 | * @var text | |
77 | */ | |
78 | public $locale_custom_strings; | |
c3fc2621 | 79 | |
e501603b | 80 | /** |
f41f0342 | 81 | * Class constructor. |
e501603b | 82 | */ |
c3fc2621 | 83 | public function __construct() { |
e501603b TO |
84 | $this->__table = 'civicrm_domain'; |
85 | parent::__construct(); | |
86 | } | |
c3fc2621 | 87 | |
e501603b | 88 | /** |
f41f0342 | 89 | * Returns foreign keys and entity references. |
e501603b TO |
90 | * |
91 | * @return array | |
92 | * [CRM_Core_Reference_Interface] | |
93 | */ | |
c3fc2621 | 94 | public static function getReferenceColumns() { |
346aaaba | 95 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 96 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
346aaaba | 98 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 99 | } |
346aaaba | 100 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 101 | } |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * Returns all the column names of this table | |
105 | * | |
106 | * @return array | |
107 | */ | |
c3fc2621 | 108 | public static function &fields() { |
346aaaba | 109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
110 | Civi::$statics[__CLASS__]['fields'] = [ |
111 | 'id' => [ | |
e501603b TO |
112 | 'name' => 'id', |
113 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 114 | 'title' => ts('Domain ID'), |
215b423e | 115 | 'description' => ts('Domain ID'), |
c3fc2621 | 116 | 'required' => TRUE, |
a36434b9 | 117 | 'where' => 'civicrm_domain.id', |
522a26c9 | 118 | 'table_name' => 'civicrm_domain', |
119 | 'entity' => 'Domain', | |
120 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 121 | 'localizable' => 0, |
c3fc2621 CW |
122 | ], |
123 | 'name' => [ | |
e501603b TO |
124 | 'name' => 'name', |
125 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 126 | 'title' => ts('Domain Name'), |
215b423e | 127 | 'description' => ts('Name of Domain / Organization'), |
e501603b TO |
128 | 'maxlength' => 64, |
129 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 130 | 'where' => 'civicrm_domain.name', |
522a26c9 | 131 | 'table_name' => 'civicrm_domain', |
132 | 'entity' => 'Domain', | |
133 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 134 | 'localizable' => 0, |
c3fc2621 | 135 | 'html' => [ |
e501603b | 136 | 'type' => 'Text', |
c3fc2621 CW |
137 | ], |
138 | ], | |
139 | 'description' => [ | |
e501603b TO |
140 | 'name' => 'description', |
141 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 142 | 'title' => ts('Domain Description'), |
215b423e | 143 | 'description' => ts('Description of Domain.'), |
e501603b TO |
144 | 'maxlength' => 255, |
145 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 146 | 'where' => 'civicrm_domain.description', |
522a26c9 | 147 | 'table_name' => 'civicrm_domain', |
148 | 'entity' => 'Domain', | |
149 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 150 | 'localizable' => 0, |
c3fc2621 | 151 | 'html' => [ |
e501603b | 152 | 'type' => 'Text', |
c3fc2621 CW |
153 | ], |
154 | ], | |
c3fc2621 | 155 | 'version' => [ |
e501603b TO |
156 | 'name' => 'version', |
157 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 158 | 'title' => ts('CiviCRM Version'), |
215b423e | 159 | 'description' => ts('The civicrm version this instance is running'), |
e501603b TO |
160 | 'maxlength' => 32, |
161 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 162 | 'where' => 'civicrm_domain.version', |
522a26c9 | 163 | 'table_name' => 'civicrm_domain', |
164 | 'entity' => 'Domain', | |
165 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 166 | 'localizable' => 0, |
c3fc2621 CW |
167 | ], |
168 | 'contact_id' => [ | |
e501603b TO |
169 | 'name' => 'contact_id', |
170 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 171 | 'title' => ts('Domain Contact'), |
215b423e | 172 | 'description' => ts('FK to Contact ID. This is specifically not an FK to avoid circular constraints'), |
a36434b9 | 173 | 'where' => 'civicrm_domain.contact_id', |
522a26c9 | 174 | 'table_name' => 'civicrm_domain', |
175 | 'entity' => 'Domain', | |
176 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 177 | 'localizable' => 0, |
e501603b | 178 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
179 | ], |
180 | 'locales' => [ | |
e501603b TO |
181 | 'name' => 'locales', |
182 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 183 | 'title' => ts('Supported Languages'), |
215b423e | 184 | 'description' => ts('list of locales supported by the current db state (NULL for single-lang install)'), |
a36434b9 | 185 | 'where' => 'civicrm_domain.locales', |
522a26c9 | 186 | 'table_name' => 'civicrm_domain', |
187 | 'entity' => 'Domain', | |
188 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 189 | 'localizable' => 0, |
c3fc2621 CW |
190 | ], |
191 | 'locale_custom_strings' => [ | |
e501603b TO |
192 | 'name' => 'locale_custom_strings', |
193 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 194 | 'title' => ts('Language Customizations'), |
215b423e | 195 | 'description' => ts('Locale specific string overrides'), |
a36434b9 | 196 | 'where' => 'civicrm_domain.locale_custom_strings', |
522a26c9 | 197 | 'table_name' => 'civicrm_domain', |
198 | 'entity' => 'Domain', | |
199 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 200 | 'localizable' => 0, |
2a5c9b4d | 201 | 'serialize' => self::SERIALIZE_PHP, |
c3fc2621 CW |
202 | ], |
203 | ]; | |
346aaaba | 204 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 205 | } |
346aaaba | 206 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 207 | } |
c3fc2621 | 208 | |
e501603b | 209 | /** |
bd8e0b14 | 210 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
211 | * |
212 | * @return array | |
bd8e0b14 | 213 | * Array(string $name => string $uniqueName). |
e501603b | 214 | */ |
c3fc2621 | 215 | public static function &fieldKeys() { |
bd8e0b14 TO |
216 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
217 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 218 | } |
bd8e0b14 | 219 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 220 | } |
c3fc2621 | 221 | |
e501603b TO |
222 | /** |
223 | * Returns the names of this table | |
224 | * | |
225 | * @return string | |
226 | */ | |
c3fc2621 | 227 | public static function getTableName() { |
e501603b TO |
228 | return self::$_tableName; |
229 | } | |
c3fc2621 | 230 | |
e501603b TO |
231 | /** |
232 | * Returns if this table needs to be logged | |
233 | * | |
c3fc2621 | 234 | * @return bool |
e501603b | 235 | */ |
c3fc2621 | 236 | public function getLog() { |
e501603b TO |
237 | return self::$_log; |
238 | } | |
c3fc2621 | 239 | |
e501603b TO |
240 | /** |
241 | * Returns the list of fields that can be imported | |
242 | * | |
243 | * @param bool $prefix | |
244 | * | |
245 | * @return array | |
246 | */ | |
c3fc2621 CW |
247 | public static function &import($prefix = FALSE) { |
248 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'domain', $prefix, []); | |
60808919 | 249 | return $r; |
e501603b | 250 | } |
c3fc2621 | 251 | |
e501603b TO |
252 | /** |
253 | * Returns the list of fields that can be exported | |
254 | * | |
255 | * @param bool $prefix | |
256 | * | |
257 | * @return array | |
258 | */ | |
c3fc2621 CW |
259 | public static function &export($prefix = FALSE) { |
260 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'domain', $prefix, []); | |
60808919 | 261 | return $r; |
e501603b | 262 | } |
c3fc2621 | 263 | |
e7a6b91a AS |
264 | /** |
265 | * Returns the list of indices | |
c3fc2621 CW |
266 | * |
267 | * @param bool $localize | |
268 | * | |
269 | * @return array | |
e7a6b91a AS |
270 | */ |
271 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
272 | $indices = [ |
273 | 'UI_name' => [ | |
e7a6b91a | 274 | 'name' => 'UI_name', |
c3fc2621 | 275 | 'field' => [ |
e7a6b91a | 276 | 0 => 'name', |
c3fc2621 CW |
277 | ], |
278 | 'localizable' => FALSE, | |
279 | 'unique' => TRUE, | |
e7a6b91a | 280 | 'sig' => 'civicrm_domain::1::name', |
c3fc2621 CW |
281 | ], |
282 | ]; | |
e7a6b91a AS |
283 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
284 | } | |
c3fc2621 | 285 | |
e501603b | 286 | } |