Merge pull request #20561 from WeMoveEU/fix/double-autosave
[civicrm-core.git] / CRM / Core / DAO / LocBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/LocBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0da5161ce83d29bc7626c1a3b74b2950)
10 */
11
12 /**
13 * Database access object for the LocBlock entity.
14 */
15 class CRM_Core_DAO_LocBlock extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_loc_block';
25
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-map-o';
32
33 /**
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
35 *
36 * @var bool
37 */
38 public static $_log = TRUE;
39
40 /**
41 * Unique ID
42 *
43 * @var int
44 */
45 public $id;
46
47 /**
48 * @var int
49 */
50 public $address_id;
51
52 /**
53 * @var int
54 */
55 public $email_id;
56
57 /**
58 * @var int
59 */
60 public $phone_id;
61
62 /**
63 * @var int
64 */
65 public $im_id;
66
67 /**
68 * @var int
69 */
70 public $address_2_id;
71
72 /**
73 * @var int
74 */
75 public $email_2_id;
76
77 /**
78 * @var int
79 */
80 public $phone_2_id;
81
82 /**
83 * @var int
84 */
85 public $im_2_id;
86
87 /**
88 * Class constructor.
89 */
90 public function __construct() {
91 $this->__table = 'civicrm_loc_block';
92 parent::__construct();
93 }
94
95 /**
96 * Returns localized title of this entity.
97 *
98 * @param bool $plural
99 * Whether to return the plural version of the title.
100 */
101 public static function getEntityTitle($plural = FALSE) {
102 return $plural ? ts('Locations') : ts('Location');
103 }
104
105 /**
106 * Returns foreign keys and entity references.
107 *
108 * @return array
109 * [CRM_Core_Reference_Interface]
110 */
111 public static function getReferenceColumns() {
112 if (!isset(Civi::$statics[__CLASS__]['links'])) {
113 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id');
115 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
116 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id');
118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id');
119 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id');
120 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id');
122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
123 }
124 return Civi::$statics[__CLASS__]['links'];
125 }
126
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 public static function &fields() {
133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
134 Civi::$statics[__CLASS__]['fields'] = [
135 'id' => [
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Location Block ID'),
139 'description' => ts('Unique ID'),
140 'required' => TRUE,
141 'where' => 'civicrm_loc_block.id',
142 'table_name' => 'civicrm_loc_block',
143 'entity' => 'LocBlock',
144 'bao' => 'CRM_Core_DAO_LocBlock',
145 'localizable' => 0,
146 'html' => [
147 'type' => 'Number',
148 ],
149 'readonly' => TRUE,
150 'add' => '2.0',
151 ],
152 'address_id' => [
153 'name' => 'address_id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Address ID'),
156 'where' => 'civicrm_loc_block.address_id',
157 'table_name' => 'civicrm_loc_block',
158 'entity' => 'LocBlock',
159 'bao' => 'CRM_Core_DAO_LocBlock',
160 'localizable' => 0,
161 'FKClassName' => 'CRM_Core_DAO_Address',
162 'html' => [
163 'label' => ts("Address"),
164 ],
165 'add' => '2.0',
166 ],
167 'email_id' => [
168 'name' => 'email_id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Email ID'),
171 'where' => 'civicrm_loc_block.email_id',
172 'table_name' => 'civicrm_loc_block',
173 'entity' => 'LocBlock',
174 'bao' => 'CRM_Core_DAO_LocBlock',
175 'localizable' => 0,
176 'FKClassName' => 'CRM_Core_DAO_Email',
177 'html' => [
178 'label' => ts("Email"),
179 ],
180 'add' => '2.0',
181 ],
182 'phone_id' => [
183 'name' => 'phone_id',
184 'type' => CRM_Utils_Type::T_INT,
185 'title' => ts('Phone ID'),
186 'where' => 'civicrm_loc_block.phone_id',
187 'table_name' => 'civicrm_loc_block',
188 'entity' => 'LocBlock',
189 'bao' => 'CRM_Core_DAO_LocBlock',
190 'localizable' => 0,
191 'FKClassName' => 'CRM_Core_DAO_Phone',
192 'html' => [
193 'label' => ts("Phone"),
194 ],
195 'add' => '2.0',
196 ],
197 'im_id' => [
198 'name' => 'im_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('IM ID'),
201 'where' => 'civicrm_loc_block.im_id',
202 'table_name' => 'civicrm_loc_block',
203 'entity' => 'LocBlock',
204 'bao' => 'CRM_Core_DAO_LocBlock',
205 'localizable' => 0,
206 'FKClassName' => 'CRM_Core_DAO_IM',
207 'html' => [
208 'label' => ts("Instant Messenger"),
209 ],
210 'add' => '2.0',
211 ],
212 'address_2_id' => [
213 'name' => 'address_2_id',
214 'type' => CRM_Utils_Type::T_INT,
215 'title' => ts('Address 2 ID'),
216 'where' => 'civicrm_loc_block.address_2_id',
217 'table_name' => 'civicrm_loc_block',
218 'entity' => 'LocBlock',
219 'bao' => 'CRM_Core_DAO_LocBlock',
220 'localizable' => 0,
221 'FKClassName' => 'CRM_Core_DAO_Address',
222 'html' => [
223 'label' => ts("Address 2"),
224 ],
225 'add' => '2.0',
226 ],
227 'email_2_id' => [
228 'name' => 'email_2_id',
229 'type' => CRM_Utils_Type::T_INT,
230 'title' => ts('Email 2 ID'),
231 'where' => 'civicrm_loc_block.email_2_id',
232 'table_name' => 'civicrm_loc_block',
233 'entity' => 'LocBlock',
234 'bao' => 'CRM_Core_DAO_LocBlock',
235 'localizable' => 0,
236 'FKClassName' => 'CRM_Core_DAO_Email',
237 'html' => [
238 'label' => ts("Email 2"),
239 ],
240 'add' => '2.0',
241 ],
242 'phone_2_id' => [
243 'name' => 'phone_2_id',
244 'type' => CRM_Utils_Type::T_INT,
245 'title' => ts('Phone 2 ID'),
246 'where' => 'civicrm_loc_block.phone_2_id',
247 'table_name' => 'civicrm_loc_block',
248 'entity' => 'LocBlock',
249 'bao' => 'CRM_Core_DAO_LocBlock',
250 'localizable' => 0,
251 'FKClassName' => 'CRM_Core_DAO_Phone',
252 'html' => [
253 'label' => ts("Phone 2"),
254 ],
255 'add' => '2.0',
256 ],
257 'im_2_id' => [
258 'name' => 'im_2_id',
259 'type' => CRM_Utils_Type::T_INT,
260 'title' => ts('IM 2 ID'),
261 'where' => 'civicrm_loc_block.im_2_id',
262 'table_name' => 'civicrm_loc_block',
263 'entity' => 'LocBlock',
264 'bao' => 'CRM_Core_DAO_LocBlock',
265 'localizable' => 0,
266 'FKClassName' => 'CRM_Core_DAO_IM',
267 'html' => [
268 'label' => ts("Instant Messenger 2"),
269 ],
270 'add' => '2.0',
271 ],
272 ];
273 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
274 }
275 return Civi::$statics[__CLASS__]['fields'];
276 }
277
278 /**
279 * Return a mapping from field-name to the corresponding key (as used in fields()).
280 *
281 * @return array
282 * Array(string $name => string $uniqueName).
283 */
284 public static function &fieldKeys() {
285 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
286 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
287 }
288 return Civi::$statics[__CLASS__]['fieldKeys'];
289 }
290
291 /**
292 * Returns the names of this table
293 *
294 * @return string
295 */
296 public static function getTableName() {
297 return self::$_tableName;
298 }
299
300 /**
301 * Returns if this table needs to be logged
302 *
303 * @return bool
304 */
305 public function getLog() {
306 return self::$_log;
307 }
308
309 /**
310 * Returns the list of fields that can be imported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
316 public static function &import($prefix = FALSE) {
317 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
318 return $r;
319 }
320
321 /**
322 * Returns the list of fields that can be exported
323 *
324 * @param bool $prefix
325 *
326 * @return array
327 */
328 public static function &export($prefix = FALSE) {
329 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
330 return $r;
331 }
332
333 /**
334 * Returns the list of indices
335 *
336 * @param bool $localize
337 *
338 * @return array
339 */
340 public static function indices($localize = TRUE) {
341 $indices = [];
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
343 }
344
345 }