Merge pull request #23213 from eileenmcnaughton/post
[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:941a0821b88a9225d9672cc25daa16f7)
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|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Name of Domain / Organization
44 *
45 * @var string|null
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $name;
50
51 /**
52 * Description of Domain.
53 *
54 * @var string|null
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $description;
59
60 /**
61 * The civicrm version this instance is running
62 *
63 * @var string|null
64 * (SQL type: varchar(32))
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $version;
68
69 /**
70 * FK to Contact ID. This is specifically not an FK to avoid circular constraints
71 *
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
75 */
76 public $contact_id;
77
78 /**
79 * list of locales supported by the current db state (NULL for single-lang install)
80 *
81 * @var string|null
82 * (SQL type: text)
83 * Note that values will be retrieved from the database as a string.
84 */
85 public $locales;
86
87 /**
88 * Locale specific string overrides
89 *
90 * @var string|null
91 * (SQL type: text)
92 * Note that values will be retrieved from the database as a string.
93 */
94 public $locale_custom_strings;
95
96 /**
97 * Class constructor.
98 */
99 public function __construct() {
100 $this->__table = 'civicrm_domain';
101 parent::__construct();
102 }
103
104 /**
105 * Returns localized title of this entity.
106 *
107 * @param bool $plural
108 * Whether to return the plural version of the title.
109 */
110 public static function getEntityTitle($plural = FALSE) {
111 return $plural ? ts('Domains') : ts('Domain');
112 }
113
114 /**
115 * Returns foreign keys and entity references.
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
120 public static function getReferenceColumns() {
121 if (!isset(Civi::$statics[__CLASS__]['links'])) {
122 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
123 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
124 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
125 }
126 return Civi::$statics[__CLASS__]['links'];
127 }
128
129 /**
130 * Returns all the column names of this table
131 *
132 * @return array
133 */
134 public static function &fields() {
135 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
136 Civi::$statics[__CLASS__]['fields'] = [
137 'id' => [
138 'name' => 'id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('Domain ID'),
141 'description' => ts('Domain ID'),
142 'required' => TRUE,
143 'where' => 'civicrm_domain.id',
144 'table_name' => 'civicrm_domain',
145 'entity' => 'Domain',
146 'bao' => 'CRM_Core_BAO_Domain',
147 'localizable' => 0,
148 'html' => [
149 'type' => 'Number',
150 ],
151 'readonly' => TRUE,
152 'add' => '1.1',
153 ],
154 'name' => [
155 'name' => 'name',
156 'type' => CRM_Utils_Type::T_STRING,
157 'title' => ts('Domain Name'),
158 'description' => ts('Name of Domain / Organization'),
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'where' => 'civicrm_domain.name',
162 'table_name' => 'civicrm_domain',
163 'entity' => 'Domain',
164 'bao' => 'CRM_Core_BAO_Domain',
165 'localizable' => 0,
166 'html' => [
167 'type' => 'Text',
168 ],
169 'add' => '1.1',
170 ],
171 'description' => [
172 'name' => 'description',
173 'type' => CRM_Utils_Type::T_STRING,
174 'title' => ts('Domain Description'),
175 'description' => ts('Description of Domain.'),
176 'maxlength' => 255,
177 'size' => CRM_Utils_Type::HUGE,
178 'where' => 'civicrm_domain.description',
179 'table_name' => 'civicrm_domain',
180 'entity' => 'Domain',
181 'bao' => 'CRM_Core_BAO_Domain',
182 'localizable' => 0,
183 'html' => [
184 'type' => 'Text',
185 ],
186 'add' => '1.1',
187 ],
188 'version' => [
189 'name' => 'version',
190 'type' => CRM_Utils_Type::T_STRING,
191 'title' => ts('CiviCRM Version'),
192 'description' => ts('The civicrm version this instance is running'),
193 'maxlength' => 32,
194 'size' => CRM_Utils_Type::MEDIUM,
195 'where' => 'civicrm_domain.version',
196 'table_name' => 'civicrm_domain',
197 'entity' => 'Domain',
198 'bao' => 'CRM_Core_BAO_Domain',
199 'localizable' => 0,
200 'add' => '2.0',
201 ],
202 'contact_id' => [
203 'name' => 'contact_id',
204 'type' => CRM_Utils_Type::T_INT,
205 'title' => ts('Contact ID'),
206 'description' => ts('FK to Contact ID. This is specifically not an FK to avoid circular constraints'),
207 'where' => 'civicrm_domain.contact_id',
208 'table_name' => 'civicrm_domain',
209 'entity' => 'Domain',
210 'bao' => 'CRM_Core_BAO_Domain',
211 'localizable' => 0,
212 'FKClassName' => 'CRM_Contact_DAO_Contact',
213 'html' => [
214 'label' => ts("Contact"),
215 ],
216 'add' => '4.3',
217 ],
218 'locales' => [
219 'name' => 'locales',
220 'type' => CRM_Utils_Type::T_TEXT,
221 'title' => ts('Supported Languages'),
222 'description' => ts('list of locales supported by the current db state (NULL for single-lang install)'),
223 'where' => 'civicrm_domain.locales',
224 'table_name' => 'civicrm_domain',
225 'entity' => 'Domain',
226 'bao' => 'CRM_Core_BAO_Domain',
227 'localizable' => 0,
228 'serialize' => self::SERIALIZE_SEPARATOR_TRIMMED,
229 'add' => '2.1',
230 ],
231 'locale_custom_strings' => [
232 'name' => 'locale_custom_strings',
233 'type' => CRM_Utils_Type::T_TEXT,
234 'title' => ts('Language Customizations'),
235 'description' => ts('Locale specific string overrides'),
236 'where' => 'civicrm_domain.locale_custom_strings',
237 'table_name' => 'civicrm_domain',
238 'entity' => 'Domain',
239 'bao' => 'CRM_Core_BAO_Domain',
240 'localizable' => 0,
241 'serialize' => self::SERIALIZE_PHP,
242 'add' => '3.2',
243 ],
244 ];
245 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
246 }
247 return Civi::$statics[__CLASS__]['fields'];
248 }
249
250 /**
251 * Return a mapping from field-name to the corresponding key (as used in fields()).
252 *
253 * @return array
254 * Array(string $name => string $uniqueName).
255 */
256 public static function &fieldKeys() {
257 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
258 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
259 }
260 return Civi::$statics[__CLASS__]['fieldKeys'];
261 }
262
263 /**
264 * Returns the names of this table
265 *
266 * @return string
267 */
268 public static function getTableName() {
269 return self::$_tableName;
270 }
271
272 /**
273 * Returns if this table needs to be logged
274 *
275 * @return bool
276 */
277 public function getLog() {
278 return self::$_log;
279 }
280
281 /**
282 * Returns the list of fields that can be imported
283 *
284 * @param bool $prefix
285 *
286 * @return array
287 */
288 public static function &import($prefix = FALSE) {
289 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'domain', $prefix, []);
290 return $r;
291 }
292
293 /**
294 * Returns the list of fields that can be exported
295 *
296 * @param bool $prefix
297 *
298 * @return array
299 */
300 public static function &export($prefix = FALSE) {
301 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'domain', $prefix, []);
302 return $r;
303 }
304
305 /**
306 * Returns the list of indices
307 *
308 * @param bool $localize
309 *
310 * @return array
311 */
312 public static function indices($localize = TRUE) {
313 $indices = [
314 'UI_name' => [
315 'name' => 'UI_name',
316 'field' => [
317 0 => 'name',
318 ],
319 'localizable' => FALSE,
320 'unique' => TRUE,
321 'sig' => 'civicrm_domain::1::name',
322 ],
323 ];
324 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
325 }
326
327 }