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