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