Merge pull request #14059 from Stoob/patch-2
[civicrm-core.git] / CRM / Core / DAO / LocBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/LocBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cc12c8f1ddd73d6d8b1d056dd04696e9)
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 unsigned
35 */
36 public $id;
37
38 /**
39 * @var int unsigned
40 */
41 public $address_id;
42
43 /**
44 * @var int unsigned
45 */
46 public $email_id;
47
48 /**
49 * @var int unsigned
50 */
51 public $phone_id;
52
53 /**
54 * @var int unsigned
55 */
56 public $im_id;
57
58 /**
59 * @var int unsigned
60 */
61 public $address_2_id;
62
63 /**
64 * @var int unsigned
65 */
66 public $email_2_id;
67
68 /**
69 * @var int unsigned
70 */
71 public $phone_2_id;
72
73 /**
74 * @var int unsigned
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 foreign keys and entity references.
88 *
89 * @return array
90 * [CRM_Core_Reference_Interface]
91 */
92 public static function getReferenceColumns() {
93 if (!isset(Civi::$statics[__CLASS__]['links'])) {
94 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
95 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_id', 'civicrm_address', 'id');
96 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
97 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
98 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_id', 'civicrm_im', 'id');
99 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'address_2_id', 'civicrm_address', 'id');
100 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_2_id', 'civicrm_email', 'id');
101 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'im_2_id', 'civicrm_im', 'id');
103 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
104 }
105 return Civi::$statics[__CLASS__]['links'];
106 }
107
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
113 public static function &fields() {
114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
115 Civi::$statics[__CLASS__]['fields'] = [
116 'id' => [
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Location Block ID'),
120 'description' => ts('Unique ID'),
121 'required' => TRUE,
122 'where' => 'civicrm_loc_block.id',
123 'table_name' => 'civicrm_loc_block',
124 'entity' => 'LocBlock',
125 'bao' => 'CRM_Core_DAO_LocBlock',
126 'localizable' => 0,
127 ],
128 'address_id' => [
129 'name' => 'address_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Location Block Address'),
132 'where' => 'civicrm_loc_block.address_id',
133 'table_name' => 'civicrm_loc_block',
134 'entity' => 'LocBlock',
135 'bao' => 'CRM_Core_DAO_LocBlock',
136 'localizable' => 0,
137 'FKClassName' => 'CRM_Core_DAO_Address',
138 ],
139 'email_id' => [
140 'name' => 'email_id',
141 'type' => CRM_Utils_Type::T_INT,
142 'title' => ts('Location Block Email'),
143 'where' => 'civicrm_loc_block.email_id',
144 'table_name' => 'civicrm_loc_block',
145 'entity' => 'LocBlock',
146 'bao' => 'CRM_Core_DAO_LocBlock',
147 'localizable' => 0,
148 'FKClassName' => 'CRM_Core_DAO_Email',
149 ],
150 'phone_id' => [
151 'name' => 'phone_id',
152 'type' => CRM_Utils_Type::T_INT,
153 'title' => ts('Location Block Phone'),
154 'where' => 'civicrm_loc_block.phone_id',
155 'table_name' => 'civicrm_loc_block',
156 'entity' => 'LocBlock',
157 'bao' => 'CRM_Core_DAO_LocBlock',
158 'localizable' => 0,
159 'FKClassName' => 'CRM_Core_DAO_Phone',
160 ],
161 'im_id' => [
162 'name' => 'im_id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('Location Block IM'),
165 'where' => 'civicrm_loc_block.im_id',
166 'table_name' => 'civicrm_loc_block',
167 'entity' => 'LocBlock',
168 'bao' => 'CRM_Core_DAO_LocBlock',
169 'localizable' => 0,
170 'FKClassName' => 'CRM_Core_DAO_IM',
171 ],
172 'address_2_id' => [
173 'name' => 'address_2_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Location Block IM 2'),
176 'where' => 'civicrm_loc_block.address_2_id',
177 'table_name' => 'civicrm_loc_block',
178 'entity' => 'LocBlock',
179 'bao' => 'CRM_Core_DAO_LocBlock',
180 'localizable' => 0,
181 'FKClassName' => 'CRM_Core_DAO_Address',
182 ],
183 'email_2_id' => [
184 'name' => 'email_2_id',
185 'type' => CRM_Utils_Type::T_INT,
186 'title' => ts('Email 2'),
187 'where' => 'civicrm_loc_block.email_2_id',
188 'table_name' => 'civicrm_loc_block',
189 'entity' => 'LocBlock',
190 'bao' => 'CRM_Core_DAO_LocBlock',
191 'localizable' => 0,
192 'FKClassName' => 'CRM_Core_DAO_Email',
193 ],
194 'phone_2_id' => [
195 'name' => 'phone_2_id',
196 'type' => CRM_Utils_Type::T_INT,
197 'title' => ts('Phone 2'),
198 'where' => 'civicrm_loc_block.phone_2_id',
199 'table_name' => 'civicrm_loc_block',
200 'entity' => 'LocBlock',
201 'bao' => 'CRM_Core_DAO_LocBlock',
202 'localizable' => 0,
203 'FKClassName' => 'CRM_Core_DAO_Phone',
204 ],
205 'im_2_id' => [
206 'name' => 'im_2_id',
207 'type' => CRM_Utils_Type::T_INT,
208 'title' => ts('Instant Messenger 2'),
209 'where' => 'civicrm_loc_block.im_2_id',
210 'table_name' => 'civicrm_loc_block',
211 'entity' => 'LocBlock',
212 'bao' => 'CRM_Core_DAO_LocBlock',
213 'localizable' => 0,
214 'FKClassName' => 'CRM_Core_DAO_IM',
215 ],
216 ];
217 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
218 }
219 return Civi::$statics[__CLASS__]['fields'];
220 }
221
222 /**
223 * Return a mapping from field-name to the corresponding key (as used in fields()).
224 *
225 * @return array
226 * Array(string $name => string $uniqueName).
227 */
228 public static function &fieldKeys() {
229 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
230 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
231 }
232 return Civi::$statics[__CLASS__]['fieldKeys'];
233 }
234
235 /**
236 * Returns the names of this table
237 *
238 * @return string
239 */
240 public static function getTableName() {
241 return self::$_tableName;
242 }
243
244 /**
245 * Returns if this table needs to be logged
246 *
247 * @return bool
248 */
249 public function getLog() {
250 return self::$_log;
251 }
252
253 /**
254 * Returns the list of fields that can be imported
255 *
256 * @param bool $prefix
257 *
258 * @return array
259 */
260 public static function &import($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
262 return $r;
263 }
264
265 /**
266 * Returns the list of fields that can be exported
267 *
268 * @param bool $prefix
269 *
270 * @return array
271 */
272 public static function &export($prefix = FALSE) {
273 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
274 return $r;
275 }
276
277 /**
278 * Returns the list of indices
279 *
280 * @param bool $localize
281 *
282 * @return array
283 */
284 public static function indices($localize = TRUE) {
285 $indices = [];
286 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
287 }
288
289 }