5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/LocBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4153042d9ec41d2841dc085180f6e16b)
13 * Database access object for the LocBlock entity.
15 class CRM_Core_DAO_LocBlock
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.0';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_loc_block';
27 * Icon associated with this entity.
31 public static $_icon = 'fa-map-o';
34 * Should CiviCRM log any modifications to this table in the civicrm_log table.
38 public static $_log = TRUE;
43 * @var int|string|null
44 * (SQL type: int unsigned)
45 * Note that values will be retrieved from the database as a string.
50 * @var int|string|null
51 * (SQL type: int unsigned)
52 * Note that values will be retrieved from the database as a string.
57 * @var int|string|null
58 * (SQL type: int unsigned)
59 * Note that values will be retrieved from the database as a string.
64 * @var int|string|null
65 * (SQL type: int unsigned)
66 * Note that values will be retrieved from the database as a string.
71 * @var int|string|null
72 * (SQL type: int unsigned)
73 * Note that values will be retrieved from the database as a string.
78 * @var int|string|null
79 * (SQL type: int unsigned)
80 * Note that values will be retrieved from the database as a string.
85 * @var int|string|null
86 * (SQL type: int unsigned)
87 * Note that values will be retrieved from the database as a string.
92 * @var int|string|null
93 * (SQL type: int unsigned)
94 * Note that values will be retrieved from the database as a string.
99 * @var int|string|null
100 * (SQL type: int unsigned)
101 * Note that values will be retrieved from the database as a string.
108 public function __construct() {
109 $this->__table
= 'civicrm_loc_block';
110 parent
::__construct();
114 * Returns localized title of this entity.
116 * @param bool $plural
117 * Whether to return the plural version of the title.
119 public static function getEntityTitle($plural = FALSE) {
120 return $plural ?
ts('Locations') : ts('Location');
124 * Returns foreign keys and entity references.
127 * [CRM_Core_Reference_Interface]
129 public static function getReferenceColumns() {
130 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
131 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
132 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'address_id', 'civicrm_address', 'id');
133 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_id', 'civicrm_email', 'id');
134 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'phone_id', 'civicrm_phone', 'id');
135 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'im_id', 'civicrm_im', 'id');
136 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'address_2_id', 'civicrm_address', 'id');
137 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'email_2_id', 'civicrm_email', 'id');
138 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'phone_2_id', 'civicrm_phone', 'id');
139 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'im_2_id', 'civicrm_im', 'id');
140 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
142 return Civi
::$statics[__CLASS__
]['links'];
146 * Returns all the column names of this table
150 public static function &fields() {
151 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
152 Civi
::$statics[__CLASS__
]['fields'] = [
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Location Block ID'),
157 'description' => ts('Unique ID'),
159 'where' => 'civicrm_loc_block.id',
160 'table_name' => 'civicrm_loc_block',
161 'entity' => 'LocBlock',
162 'bao' => 'CRM_Core_DAO_LocBlock',
171 'name' => 'address_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Address ID'),
174 'where' => 'civicrm_loc_block.address_id',
175 'table_name' => 'civicrm_loc_block',
176 'entity' => 'LocBlock',
177 'bao' => 'CRM_Core_DAO_LocBlock',
179 'FKClassName' => 'CRM_Core_DAO_Address',
181 'label' => ts("Address"),
186 'name' => 'email_id',
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Email ID'),
189 'where' => 'civicrm_loc_block.email_id',
190 'table_name' => 'civicrm_loc_block',
191 'entity' => 'LocBlock',
192 'bao' => 'CRM_Core_DAO_LocBlock',
194 'FKClassName' => 'CRM_Core_DAO_Email',
196 'label' => ts("Email"),
201 'name' => 'phone_id',
202 'type' => CRM_Utils_Type
::T_INT
,
203 'title' => ts('Phone ID'),
204 'where' => 'civicrm_loc_block.phone_id',
205 'table_name' => 'civicrm_loc_block',
206 'entity' => 'LocBlock',
207 'bao' => 'CRM_Core_DAO_LocBlock',
209 'FKClassName' => 'CRM_Core_DAO_Phone',
211 'label' => ts("Phone"),
217 'type' => CRM_Utils_Type
::T_INT
,
218 'title' => ts('IM ID'),
219 'where' => 'civicrm_loc_block.im_id',
220 'table_name' => 'civicrm_loc_block',
221 'entity' => 'LocBlock',
222 'bao' => 'CRM_Core_DAO_LocBlock',
224 'FKClassName' => 'CRM_Core_DAO_IM',
226 'label' => ts("Instant Messenger"),
231 'name' => 'address_2_id',
232 'type' => CRM_Utils_Type
::T_INT
,
233 'title' => ts('Address 2 ID'),
234 'where' => 'civicrm_loc_block.address_2_id',
235 'table_name' => 'civicrm_loc_block',
236 'entity' => 'LocBlock',
237 'bao' => 'CRM_Core_DAO_LocBlock',
239 'FKClassName' => 'CRM_Core_DAO_Address',
241 'label' => ts("Address 2"),
246 'name' => 'email_2_id',
247 'type' => CRM_Utils_Type
::T_INT
,
248 'title' => ts('Email 2 ID'),
249 'where' => 'civicrm_loc_block.email_2_id',
250 'table_name' => 'civicrm_loc_block',
251 'entity' => 'LocBlock',
252 'bao' => 'CRM_Core_DAO_LocBlock',
254 'FKClassName' => 'CRM_Core_DAO_Email',
256 'label' => ts("Email 2"),
261 'name' => 'phone_2_id',
262 'type' => CRM_Utils_Type
::T_INT
,
263 'title' => ts('Phone 2 ID'),
264 'where' => 'civicrm_loc_block.phone_2_id',
265 'table_name' => 'civicrm_loc_block',
266 'entity' => 'LocBlock',
267 'bao' => 'CRM_Core_DAO_LocBlock',
269 'FKClassName' => 'CRM_Core_DAO_Phone',
271 'label' => ts("Phone 2"),
277 'type' => CRM_Utils_Type
::T_INT
,
278 'title' => ts('IM 2 ID'),
279 'where' => 'civicrm_loc_block.im_2_id',
280 'table_name' => 'civicrm_loc_block',
281 'entity' => 'LocBlock',
282 'bao' => 'CRM_Core_DAO_LocBlock',
284 'FKClassName' => 'CRM_Core_DAO_IM',
286 'label' => ts("Instant Messenger 2"),
291 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
293 return Civi
::$statics[__CLASS__
]['fields'];
297 * Return a mapping from field-name to the corresponding key (as used in fields()).
300 * Array(string $name => string $uniqueName).
302 public static function &fieldKeys() {
303 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
304 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
306 return Civi
::$statics[__CLASS__
]['fieldKeys'];
310 * Returns the names of this table
314 public static function getTableName() {
315 return self
::$_tableName;
319 * Returns if this table needs to be logged
323 public function getLog() {
328 * Returns the list of fields that can be imported
330 * @param bool $prefix
334 public static function &import($prefix = FALSE) {
335 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'loc_block', $prefix, []);
340 * Returns the list of fields that can be exported
342 * @param bool $prefix
346 public static function &export($prefix = FALSE) {
347 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'loc_block', $prefix, []);
352 * Returns the list of indices
354 * @param bool $localize
358 public static function indices($localize = TRUE) {
360 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;