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 | |
7b66c3b5 | 9 | * (GenCodeChecksum:99a50c29878792b8864e20d184ce9bbb) |
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, |
a9d0587b | 134 | 'add' => '1.1', |
c3fc2621 CW |
135 | ], |
136 | 'name' => [ | |
e501603b TO |
137 | 'name' => 'name', |
138 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 139 | 'title' => ts('Domain Name'), |
215b423e | 140 | 'description' => ts('Name of Domain / Organization'), |
e501603b TO |
141 | 'maxlength' => 64, |
142 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 143 | 'where' => 'civicrm_domain.name', |
522a26c9 | 144 | 'table_name' => 'civicrm_domain', |
145 | 'entity' => 'Domain', | |
146 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 147 | 'localizable' => 0, |
c3fc2621 | 148 | 'html' => [ |
e501603b | 149 | 'type' => 'Text', |
c3fc2621 | 150 | ], |
a9d0587b | 151 | 'add' => '1.1', |
c3fc2621 CW |
152 | ], |
153 | 'description' => [ | |
e501603b TO |
154 | 'name' => 'description', |
155 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 156 | 'title' => ts('Domain Description'), |
215b423e | 157 | 'description' => ts('Description of Domain.'), |
e501603b TO |
158 | 'maxlength' => 255, |
159 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 160 | 'where' => 'civicrm_domain.description', |
522a26c9 | 161 | 'table_name' => 'civicrm_domain', |
162 | 'entity' => 'Domain', | |
163 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 164 | 'localizable' => 0, |
c3fc2621 | 165 | 'html' => [ |
e501603b | 166 | 'type' => 'Text', |
c3fc2621 | 167 | ], |
a9d0587b | 168 | 'add' => '1.1', |
c3fc2621 | 169 | ], |
c3fc2621 | 170 | 'version' => [ |
e501603b TO |
171 | 'name' => 'version', |
172 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 173 | 'title' => ts('CiviCRM Version'), |
215b423e | 174 | 'description' => ts('The civicrm version this instance is running'), |
e501603b TO |
175 | 'maxlength' => 32, |
176 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 177 | 'where' => 'civicrm_domain.version', |
522a26c9 | 178 | 'table_name' => 'civicrm_domain', |
179 | 'entity' => 'Domain', | |
180 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 181 | 'localizable' => 0, |
a9d0587b | 182 | 'add' => '2.0', |
c3fc2621 CW |
183 | ], |
184 | 'contact_id' => [ | |
e501603b TO |
185 | 'name' => 'contact_id', |
186 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 187 | 'title' => ts('Domain Contact'), |
215b423e | 188 | 'description' => ts('FK to Contact ID. This is specifically not an FK to avoid circular constraints'), |
a36434b9 | 189 | 'where' => 'civicrm_domain.contact_id', |
522a26c9 | 190 | 'table_name' => 'civicrm_domain', |
191 | 'entity' => 'Domain', | |
192 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 193 | 'localizable' => 0, |
e501603b | 194 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
a9d0587b | 195 | 'add' => '4.3', |
c3fc2621 CW |
196 | ], |
197 | 'locales' => [ | |
e501603b TO |
198 | 'name' => 'locales', |
199 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 200 | 'title' => ts('Supported Languages'), |
215b423e | 201 | 'description' => ts('list of locales supported by the current db state (NULL for single-lang install)'), |
a36434b9 | 202 | 'where' => 'civicrm_domain.locales', |
522a26c9 | 203 | 'table_name' => 'civicrm_domain', |
204 | 'entity' => 'Domain', | |
205 | 'bao' => 'CRM_Core_BAO_Domain', | |
6a7e5e5d | 206 | 'localizable' => 0, |
1be376e5 | 207 | 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED, |
a9d0587b | 208 | 'add' => '2.1', |
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, |
a9d0587b | 221 | 'add' => '3.2', |
c3fc2621 CW |
222 | ], |
223 | ]; | |
346aaaba | 224 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 225 | } |
346aaaba | 226 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 227 | } |
c3fc2621 | 228 | |
e501603b | 229 | /** |
bd8e0b14 | 230 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
231 | * |
232 | * @return array | |
bd8e0b14 | 233 | * Array(string $name => string $uniqueName). |
e501603b | 234 | */ |
c3fc2621 | 235 | public static function &fieldKeys() { |
bd8e0b14 TO |
236 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
237 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 238 | } |
bd8e0b14 | 239 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 240 | } |
c3fc2621 | 241 | |
e501603b TO |
242 | /** |
243 | * Returns the names of this table | |
244 | * | |
245 | * @return string | |
246 | */ | |
c3fc2621 | 247 | public static function getTableName() { |
e501603b TO |
248 | return self::$_tableName; |
249 | } | |
c3fc2621 | 250 | |
e501603b TO |
251 | /** |
252 | * Returns if this table needs to be logged | |
253 | * | |
c3fc2621 | 254 | * @return bool |
e501603b | 255 | */ |
c3fc2621 | 256 | public function getLog() { |
e501603b TO |
257 | return self::$_log; |
258 | } | |
c3fc2621 | 259 | |
e501603b TO |
260 | /** |
261 | * Returns the list of fields that can be imported | |
262 | * | |
263 | * @param bool $prefix | |
264 | * | |
265 | * @return array | |
266 | */ | |
c3fc2621 CW |
267 | public static function &import($prefix = FALSE) { |
268 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'domain', $prefix, []); | |
60808919 | 269 | return $r; |
e501603b | 270 | } |
c3fc2621 | 271 | |
e501603b TO |
272 | /** |
273 | * Returns the list of fields that can be exported | |
274 | * | |
275 | * @param bool $prefix | |
276 | * | |
277 | * @return array | |
278 | */ | |
c3fc2621 CW |
279 | public static function &export($prefix = FALSE) { |
280 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'domain', $prefix, []); | |
60808919 | 281 | return $r; |
e501603b | 282 | } |
c3fc2621 | 283 | |
e7a6b91a AS |
284 | /** |
285 | * Returns the list of indices | |
c3fc2621 CW |
286 | * |
287 | * @param bool $localize | |
288 | * | |
289 | * @return array | |
e7a6b91a AS |
290 | */ |
291 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
292 | $indices = [ |
293 | 'UI_name' => [ | |
e7a6b91a | 294 | 'name' => 'UI_name', |
c3fc2621 | 295 | 'field' => [ |
e7a6b91a | 296 | 0 => 'name', |
c3fc2621 CW |
297 | ], |
298 | 'localizable' => FALSE, | |
299 | 'unique' => TRUE, | |
e7a6b91a | 300 | 'sig' => 'civicrm_domain::1::name', |
c3fc2621 CW |
301 | ], |
302 | ]; | |
e7a6b91a AS |
303 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
304 | } | |
c3fc2621 | 305 | |
e501603b | 306 | } |