Merge pull request #18159 from civicrm/5.29
[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:8459c5a6d25e5c70e44de49b109a82fa)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = TRUE;
32
33 /**
34 * Unique ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * @var int
42 */
43 public $address_id;
44
45 /**
46 * @var int
47 */
48 public $email_id;
49
50 /**
51 * @var int
52 */
53 public $phone_id;
54
55 /**
56 * @var int
57 */
58 public $im_id;
59
60 /**
61 * @var int
62 */
63 public $address_2_id;
64
65 /**
66 * @var int
67 */
68 public $email_2_id;
69
70 /**
71 * @var int
72 */
73 public $phone_2_id;
74
75 /**
76 * @var int
77 */
78 public $im_2_id;
79
80 /**
81 * Class constructor.
82 */
83 public function __construct() {
84 $this->__table = 'civicrm_loc_block';
85 parent::__construct();
86 }
87
88 /**
89 * Returns localized title of this entity.
90 */
91 public static function getEntityTitle() {
92 return ts('Loc Blocks');
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(), 'address_id', 'civicrm_address', 'id');
105 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
106 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
107 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id');
108 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id');
109 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id');
110 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
111 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id');
112 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
113 }
114 return Civi::$statics[__CLASS__]['links'];
115 }
116
117 /**
118 * Returns all the column names of this table
119 *
120 * @return array
121 */
122 public static function &fields() {
123 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
124 Civi::$statics[__CLASS__]['fields'] = [
125 'id' => [
126 'name' => 'id',
127 'type' => CRM_Utils_Type::T_INT,
128 'title' => ts('Location Block ID'),
129 'description' => ts('Unique ID'),
130 'required' => TRUE,
131 'where' => 'civicrm_loc_block.id',
132 'table_name' => 'civicrm_loc_block',
133 'entity' => 'LocBlock',
134 'bao' => 'CRM_Core_DAO_LocBlock',
135 'localizable' => 0,
136 'add' => '2.0',
137 ],
138 'address_id' => [
139 'name' => 'address_id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Location Block Address'),
142 'where' => 'civicrm_loc_block.address_id',
143 'table_name' => 'civicrm_loc_block',
144 'entity' => 'LocBlock',
145 'bao' => 'CRM_Core_DAO_LocBlock',
146 'localizable' => 0,
147 'FKClassName' => 'CRM_Core_DAO_Address',
148 'add' => '2.0',
149 ],
150 'email_id' => [
151 'name' => 'email_id',
152 'type' => CRM_Utils_Type::T_INT,
153 'title' => ts('Location Block Email'),
154 'where' => 'civicrm_loc_block.email_id',
155 'table_name' => 'civicrm_loc_block',
156 'entity' => 'LocBlock',
157 'bao' => 'CRM_Core_DAO_LocBlock',
158 'localizable' => 0,
159 'FKClassName' => 'CRM_Core_DAO_Email',
160 'add' => '2.0',
161 ],
162 'phone_id' => [
163 'name' => 'phone_id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('Location Block Phone'),
166 'where' => 'civicrm_loc_block.phone_id',
167 'table_name' => 'civicrm_loc_block',
168 'entity' => 'LocBlock',
169 'bao' => 'CRM_Core_DAO_LocBlock',
170 'localizable' => 0,
171 'FKClassName' => 'CRM_Core_DAO_Phone',
172 'add' => '2.0',
173 ],
174 'im_id' => [
175 'name' => 'im_id',
176 'type' => CRM_Utils_Type::T_INT,
177 'title' => ts('Location Block IM'),
178 'where' => 'civicrm_loc_block.im_id',
179 'table_name' => 'civicrm_loc_block',
180 'entity' => 'LocBlock',
181 'bao' => 'CRM_Core_DAO_LocBlock',
182 'localizable' => 0,
183 'FKClassName' => 'CRM_Core_DAO_IM',
184 'add' => '2.0',
185 ],
186 'address_2_id' => [
187 'name' => 'address_2_id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Location Block IM 2'),
190 'where' => 'civicrm_loc_block.address_2_id',
191 'table_name' => 'civicrm_loc_block',
192 'entity' => 'LocBlock',
193 'bao' => 'CRM_Core_DAO_LocBlock',
194 'localizable' => 0,
195 'FKClassName' => 'CRM_Core_DAO_Address',
196 'add' => '2.0',
197 ],
198 'email_2_id' => [
199 'name' => 'email_2_id',
200 'type' => CRM_Utils_Type::T_INT,
201 'title' => ts('Email 2'),
202 'where' => 'civicrm_loc_block.email_2_id',
203 'table_name' => 'civicrm_loc_block',
204 'entity' => 'LocBlock',
205 'bao' => 'CRM_Core_DAO_LocBlock',
206 'localizable' => 0,
207 'FKClassName' => 'CRM_Core_DAO_Email',
208 'add' => '2.0',
209 ],
210 'phone_2_id' => [
211 'name' => 'phone_2_id',
212 'type' => CRM_Utils_Type::T_INT,
213 'title' => ts('Phone 2'),
214 'where' => 'civicrm_loc_block.phone_2_id',
215 'table_name' => 'civicrm_loc_block',
216 'entity' => 'LocBlock',
217 'bao' => 'CRM_Core_DAO_LocBlock',
218 'localizable' => 0,
219 'FKClassName' => 'CRM_Core_DAO_Phone',
220 'add' => '2.0',
221 ],
222 'im_2_id' => [
223 'name' => 'im_2_id',
224 'type' => CRM_Utils_Type::T_INT,
225 'title' => ts('Instant Messenger 2'),
226 'where' => 'civicrm_loc_block.im_2_id',
227 'table_name' => 'civicrm_loc_block',
228 'entity' => 'LocBlock',
229 'bao' => 'CRM_Core_DAO_LocBlock',
230 'localizable' => 0,
231 'FKClassName' => 'CRM_Core_DAO_IM',
232 'add' => '2.0',
233 ],
234 ];
235 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
236 }
237 return Civi::$statics[__CLASS__]['fields'];
238 }
239
240 /**
241 * Return a mapping from field-name to the corresponding key (as used in fields()).
242 *
243 * @return array
244 * Array(string $name => string $uniqueName).
245 */
246 public static function &fieldKeys() {
247 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
248 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
249 }
250 return Civi::$statics[__CLASS__]['fieldKeys'];
251 }
252
253 /**
254 * Returns the names of this table
255 *
256 * @return string
257 */
258 public static function getTableName() {
259 return self::$_tableName;
260 }
261
262 /**
263 * Returns if this table needs to be logged
264 *
265 * @return bool
266 */
267 public function getLog() {
268 return self::$_log;
269 }
270
271 /**
272 * Returns the list of fields that can be imported
273 *
274 * @param bool $prefix
275 *
276 * @return array
277 */
278 public static function &import($prefix = FALSE) {
279 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
280 return $r;
281 }
282
283 /**
284 * Returns the list of fields that can be exported
285 *
286 * @param bool $prefix
287 *
288 * @return array
289 */
290 public static function &export($prefix = FALSE) {
291 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
292 return $r;
293 }
294
295 /**
296 * Returns the list of indices
297 *
298 * @param bool $localize
299 *
300 * @return array
301 */
302 public static function indices($localize = TRUE) {
303 $indices = [];
304 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
305 }
306
307 }