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:801a2e7e05f688cf38882b466f22a292)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
83 public function __construct() {
84 $this->__table
= 'civicrm_loc_block';
85 parent
::__construct();
89 * Returns localized title of this entity.
92 * Whether to return the plural version of the title.
94 public static function getEntityTitle($plural = FALSE) {
95 return $plural ?
ts('Loc Blocks') : ts('Loc Block');
99 * Returns foreign keys and entity references.
102 * [CRM_Core_Reference_Interface]
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']);
117 return Civi
::$statics[__CLASS__
]['links'];
121 * Returns all the column names of this table
125 public static function &fields() {
126 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
127 Civi
::$statics[__CLASS__
]['fields'] = [
130 'type' => CRM_Utils_Type
::T_INT
,
131 'title' => ts('Location Block ID'),
132 'description' => ts('Unique ID'),
134 'where' => 'civicrm_loc_block.id',
135 'table_name' => 'civicrm_loc_block',
136 'entity' => 'LocBlock',
137 'bao' => 'CRM_Core_DAO_LocBlock',
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',
150 'FKClassName' => 'CRM_Core_DAO_Address',
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',
162 'FKClassName' => 'CRM_Core_DAO_Email',
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',
174 'FKClassName' => 'CRM_Core_DAO_Phone',
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',
186 'FKClassName' => 'CRM_Core_DAO_IM',
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',
198 'FKClassName' => 'CRM_Core_DAO_Address',
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',
210 'FKClassName' => 'CRM_Core_DAO_Email',
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',
222 'FKClassName' => 'CRM_Core_DAO_Phone',
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',
234 'FKClassName' => 'CRM_Core_DAO_IM',
238 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
240 return Civi
::$statics[__CLASS__
]['fields'];
244 * Return a mapping from field-name to the corresponding key (as used in fields()).
247 * Array(string $name => string $uniqueName).
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()));
253 return Civi
::$statics[__CLASS__
]['fieldKeys'];
257 * Returns the names of this table
261 public static function getTableName() {
262 return self
::$_tableName;
266 * Returns if this table needs to be logged
270 public function getLog() {
275 * Returns the list of fields that can be imported
277 * @param bool $prefix
281 public static function &import($prefix = FALSE) {
282 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'loc_block', $prefix, []);
287 * Returns the list of fields that can be exported
289 * @param bool $prefix
293 public static function &export($prefix = FALSE) {
294 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'loc_block', $prefix, []);
299 * Returns the list of indices
301 * @param bool $localize
305 public static function indices($localize = TRUE) {
307 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;