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