Merge pull request #19093 from civicrm/5.32
[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:86653150176ca5b8f4bb80b8dc581010)
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 * @param bool $plural
92 * Whether to return the plural version of the title.
93 */
94 public static function getEntityTitle($plural = FALSE) {
95 return $plural ? ts('Loc Blocks') : ts('Loc Block');
96 }
97
98 /**
99 * Returns foreign keys and entity references.
100 *
101 * @return array
102 * [CRM_Core_Reference_Interface]
103 */
104 public static function getReferenceColumns() {
105 if (!isset(Civi::$statics[__CLASS__]['links'])) {
106 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
107 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id');
108 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
109 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
110 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id');
111 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id');
112 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id');
113 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id');
115 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
116 }
117 return Civi::$statics[__CLASS__]['links'];
118 }
119
120 /**
121 * Returns all the column names of this table
122 *
123 * @return array
124 */
125 public static function &fields() {
126 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
127 Civi::$statics[__CLASS__]['fields'] = [
128 'id' => [
129 'name' => 'id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Location Block ID'),
132 'description' => ts('Unique ID'),
133 'required' => TRUE,
134 'where' => 'civicrm_loc_block.id',
135 'table_name' => 'civicrm_loc_block',
136 'entity' => 'LocBlock',
137 'bao' => 'CRM_Core_DAO_LocBlock',
138 'localizable' => 0,
139 'add' => '2.0',
140 ],
141 'address_id' => [
142 'name' => 'address_id',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('Location Block Address'),
145 'where' => 'civicrm_loc_block.address_id',
146 'table_name' => 'civicrm_loc_block',
147 'entity' => 'LocBlock',
148 'bao' => 'CRM_Core_DAO_LocBlock',
149 'localizable' => 0,
150 'FKClassName' => 'CRM_Core_DAO_Address',
151 'add' => '2.0',
152 ],
153 'email_id' => [
154 'name' => 'email_id',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('Location Block Email'),
157 'where' => 'civicrm_loc_block.email_id',
158 'table_name' => 'civicrm_loc_block',
159 'entity' => 'LocBlock',
160 'bao' => 'CRM_Core_DAO_LocBlock',
161 'localizable' => 0,
162 'FKClassName' => 'CRM_Core_DAO_Email',
163 'add' => '2.0',
164 ],
165 'phone_id' => [
166 'name' => 'phone_id',
167 'type' => CRM_Utils_Type::T_INT,
168 'title' => ts('Location Block Phone'),
169 'where' => 'civicrm_loc_block.phone_id',
170 'table_name' => 'civicrm_loc_block',
171 'entity' => 'LocBlock',
172 'bao' => 'CRM_Core_DAO_LocBlock',
173 'localizable' => 0,
174 'FKClassName' => 'CRM_Core_DAO_Phone',
175 'add' => '2.0',
176 ],
177 'im_id' => [
178 'name' => 'im_id',
179 'type' => CRM_Utils_Type::T_INT,
180 'title' => ts('Location Block IM'),
181 'where' => 'civicrm_loc_block.im_id',
182 'table_name' => 'civicrm_loc_block',
183 'entity' => 'LocBlock',
184 'bao' => 'CRM_Core_DAO_LocBlock',
185 'localizable' => 0,
186 'FKClassName' => 'CRM_Core_DAO_IM',
187 'add' => '2.0',
188 ],
189 'address_2_id' => [
190 'name' => 'address_2_id',
191 'type' => CRM_Utils_Type::T_INT,
192 'title' => ts('Location Block IM 2'),
193 'where' => 'civicrm_loc_block.address_2_id',
194 'table_name' => 'civicrm_loc_block',
195 'entity' => 'LocBlock',
196 'bao' => 'CRM_Core_DAO_LocBlock',
197 'localizable' => 0,
198 'FKClassName' => 'CRM_Core_DAO_Address',
199 'add' => '2.0',
200 ],
201 'email_2_id' => [
202 'name' => 'email_2_id',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Email 2'),
205 'where' => 'civicrm_loc_block.email_2_id',
206 'table_name' => 'civicrm_loc_block',
207 'entity' => 'LocBlock',
208 'bao' => 'CRM_Core_DAO_LocBlock',
209 'localizable' => 0,
210 'FKClassName' => 'CRM_Core_DAO_Email',
211 'add' => '2.0',
212 ],
213 'phone_2_id' => [
214 'name' => 'phone_2_id',
215 'type' => CRM_Utils_Type::T_INT,
216 'title' => ts('Phone 2'),
217 'where' => 'civicrm_loc_block.phone_2_id',
218 'table_name' => 'civicrm_loc_block',
219 'entity' => 'LocBlock',
220 'bao' => 'CRM_Core_DAO_LocBlock',
221 'localizable' => 0,
222 'FKClassName' => 'CRM_Core_DAO_Phone',
223 'add' => '2.0',
224 ],
225 'im_2_id' => [
226 'name' => 'im_2_id',
227 'type' => CRM_Utils_Type::T_INT,
228 'title' => ts('Instant Messenger 2'),
229 'where' => 'civicrm_loc_block.im_2_id',
230 'table_name' => 'civicrm_loc_block',
231 'entity' => 'LocBlock',
232 'bao' => 'CRM_Core_DAO_LocBlock',
233 'localizable' => 0,
234 'FKClassName' => 'CRM_Core_DAO_IM',
235 'add' => '2.0',
236 ],
237 ];
238 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
239 }
240 return Civi::$statics[__CLASS__]['fields'];
241 }
242
243 /**
244 * Return a mapping from field-name to the corresponding key (as used in fields()).
245 *
246 * @return array
247 * Array(string $name => string $uniqueName).
248 */
249 public static function &fieldKeys() {
250 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
251 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
252 }
253 return Civi::$statics[__CLASS__]['fieldKeys'];
254 }
255
256 /**
257 * Returns the names of this table
258 *
259 * @return string
260 */
261 public static function getTableName() {
262 return self::$_tableName;
263 }
264
265 /**
266 * Returns if this table needs to be logged
267 *
268 * @return bool
269 */
270 public function getLog() {
271 return self::$_log;
272 }
273
274 /**
275 * Returns the list of fields that can be imported
276 *
277 * @param bool $prefix
278 *
279 * @return array
280 */
281 public static function &import($prefix = FALSE) {
282 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
283 return $r;
284 }
285
286 /**
287 * Returns the list of fields that can be exported
288 *
289 * @param bool $prefix
290 *
291 * @return array
292 */
293 public static function &export($prefix = FALSE) {
294 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
295 return $r;
296 }
297
298 /**
299 * Returns the list of indices
300 *
301 * @param bool $localize
302 *
303 * @return array
304 */
305 public static function indices($localize = TRUE) {
306 $indices = [];
307 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
308 }
309
310 }