Merge pull request #12583 from omarabuhussein/dev/core#288
[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 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 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 'table_name' => 'civicrm_loc_block',
123 'entity' => 'LocBlock',
124 'bao' => 'CRM_Core_DAO_LocBlock',
125 'localizable' => 0,
126 ],
127 'address_id' => [
128 'name' => 'address_id',
129 'type' => CRM_Utils_Type::T_INT,
130 'title' => ts('Location Block Address'),
131 'table_name' => 'civicrm_loc_block',
132 'entity' => 'LocBlock',
133 'bao' => 'CRM_Core_DAO_LocBlock',
134 'localizable' => 0,
135 'FKClassName' => 'CRM_Core_DAO_Address',
136 ],
137 'email_id' => [
138 'name' => 'email_id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('Location Block Email'),
141 'table_name' => 'civicrm_loc_block',
142 'entity' => 'LocBlock',
143 'bao' => 'CRM_Core_DAO_LocBlock',
144 'localizable' => 0,
145 'FKClassName' => 'CRM_Core_DAO_Email',
146 ],
147 'phone_id' => [
148 'name' => 'phone_id',
149 'type' => CRM_Utils_Type::T_INT,
150 'title' => ts('Location Block Phone'),
151 'table_name' => 'civicrm_loc_block',
152 'entity' => 'LocBlock',
153 'bao' => 'CRM_Core_DAO_LocBlock',
154 'localizable' => 0,
155 'FKClassName' => 'CRM_Core_DAO_Phone',
156 ],
157 'im_id' => [
158 'name' => 'im_id',
159 'type' => CRM_Utils_Type::T_INT,
160 'title' => ts('Location Block IM'),
161 'table_name' => 'civicrm_loc_block',
162 'entity' => 'LocBlock',
163 'bao' => 'CRM_Core_DAO_LocBlock',
164 'localizable' => 0,
165 'FKClassName' => 'CRM_Core_DAO_IM',
166 ],
167 'address_2_id' => [
168 'name' => 'address_2_id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Location Block IM 2'),
171 'table_name' => 'civicrm_loc_block',
172 'entity' => 'LocBlock',
173 'bao' => 'CRM_Core_DAO_LocBlock',
174 'localizable' => 0,
175 'FKClassName' => 'CRM_Core_DAO_Address',
176 ],
177 'email_2_id' => [
178 'name' => 'email_2_id',
179 'type' => CRM_Utils_Type::T_INT,
180 'title' => ts('Email 2'),
181 'table_name' => 'civicrm_loc_block',
182 'entity' => 'LocBlock',
183 'bao' => 'CRM_Core_DAO_LocBlock',
184 'localizable' => 0,
185 'FKClassName' => 'CRM_Core_DAO_Email',
186 ],
187 'phone_2_id' => [
188 'name' => 'phone_2_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Phone 2'),
191 'table_name' => 'civicrm_loc_block',
192 'entity' => 'LocBlock',
193 'bao' => 'CRM_Core_DAO_LocBlock',
194 'localizable' => 0,
195 'FKClassName' => 'CRM_Core_DAO_Phone',
196 ],
197 'im_2_id' => [
198 'name' => 'im_2_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Instant Messenger 2'),
201 'table_name' => 'civicrm_loc_block',
202 'entity' => 'LocBlock',
203 'bao' => 'CRM_Core_DAO_LocBlock',
204 'localizable' => 0,
205 'FKClassName' => 'CRM_Core_DAO_IM',
206 ],
207 ];
208 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
209 }
210 return Civi::$statics[__CLASS__]['fields'];
211 }
212
213 /**
214 * Return a mapping from field-name to the corresponding key (as used in fields()).
215 *
216 * @return array
217 * Array(string $name => string $uniqueName).
218 */
219 public static function &fieldKeys() {
220 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
221 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
222 }
223 return Civi::$statics[__CLASS__]['fieldKeys'];
224 }
225
226 /**
227 * Returns the names of this table
228 *
229 * @return string
230 */
231 public static function getTableName() {
232 return self::$_tableName;
233 }
234
235 /**
236 * Returns if this table needs to be logged
237 *
238 * @return bool
239 */
240 public function getLog() {
241 return self::$_log;
242 }
243
244 /**
245 * Returns the list of fields that can be imported
246 *
247 * @param bool $prefix
248 *
249 * @return array
250 */
251 public static function &import($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, []);
253 return $r;
254 }
255
256 /**
257 * Returns the list of fields that can be exported
258 *
259 * @param bool $prefix
260 *
261 * @return array
262 */
263 public static function &export($prefix = FALSE) {
264 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, []);
265 return $r;
266 }
267
268 /**
269 * Returns the list of indices
270 *
271 * @param bool $localize
272 *
273 * @return array
274 */
275 public static function indices($localize = TRUE) {
276 $indices = [];
277 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
278 }
279
280 }