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