5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Core/IM.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fe754a68bdda23ca881ac6425750eeba)
13 * Database access object for the IM entity.
15 class CRM_Core_DAO_IM
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_im';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
46 * Which Location does this email belong to.
50 public $location_type_id;
60 * Which IM Provider does this screen name belong to.
67 * Is this the primary IM for this contact and location.
74 * Is this the billing?
83 public function __construct() {
84 $this->__table
= 'civicrm_im';
85 parent
::__construct();
89 * Returns foreign keys and entity references.
92 * [CRM_Core_Reference_Interface]
94 public static function getReferenceColumns() {
95 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
96 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Instant Messenger ID'),
115 'description' => ts('Unique IM ID'),
117 'table_name' => 'civicrm_im',
119 'bao' => 'CRM_Core_BAO_IM',
123 'name' => 'contact_id',
124 'type' => CRM_Utils_Type
::T_INT
,
125 'title' => ts('IM Contact'),
126 'description' => ts('FK to Contact ID'),
127 'table_name' => 'civicrm_im',
129 'bao' => 'CRM_Core_BAO_IM',
131 'FKClassName' => 'CRM_Contact_DAO_Contact',
133 'location_type_id' => [
134 'name' => 'location_type_id',
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('IM Location Type'),
137 'description' => ts('Which Location does this email belong to.'),
138 'table_name' => 'civicrm_im',
140 'bao' => 'CRM_Core_BAO_IM',
145 'pseudoconstant' => [
146 'table' => 'civicrm_location_type',
148 'labelColumn' => 'display_name',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('IM Screen Name'),
155 'description' => ts('IM screen name'),
157 'size' => CRM_Utils_Type
::BIG
,
159 'where' => 'civicrm_im.name',
160 'headerPattern' => '/I(nstant )?M(ess.*)?|screen(\s+)?name/i',
161 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
163 'table_name' => 'civicrm_im',
165 'bao' => 'CRM_Core_BAO_IM',
172 'name' => 'provider_id',
173 'type' => CRM_Utils_Type
::T_INT
,
174 'title' => ts('IM Provider'),
175 'description' => ts('Which IM Provider does this screen name belong to.'),
176 'table_name' => 'civicrm_im',
178 'bao' => 'CRM_Core_BAO_IM',
183 'pseudoconstant' => [
184 'optionGroupName' => 'instant_messenger_service',
185 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
189 'name' => 'is_primary',
190 'type' => CRM_Utils_Type
::T_BOOLEAN
,
191 'title' => ts('Is IM Primary?'),
192 'description' => ts('Is this the primary IM for this contact and location.'),
194 'table_name' => 'civicrm_im',
196 'bao' => 'CRM_Core_BAO_IM',
200 'name' => 'is_billing',
201 'type' => CRM_Utils_Type
::T_BOOLEAN
,
202 'title' => ts('Is IM Billing?'),
203 'description' => ts('Is this the billing?'),
205 'table_name' => 'civicrm_im',
207 'bao' => 'CRM_Core_BAO_IM',
211 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
213 return Civi
::$statics[__CLASS__
]['fields'];
217 * Return a mapping from field-name to the corresponding key (as used in fields()).
220 * Array(string $name => string $uniqueName).
222 public static function &fieldKeys() {
223 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
224 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
226 return Civi
::$statics[__CLASS__
]['fieldKeys'];
230 * Returns the names of this table
234 public static function getTableName() {
235 return self
::$_tableName;
239 * Returns if this table needs to be logged
243 public function getLog() {
248 * Returns the list of fields that can be imported
250 * @param bool $prefix
254 public static function &import($prefix = FALSE) {
255 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'im', $prefix, []);
260 * Returns the list of fields that can be exported
262 * @param bool $prefix
266 public static function &export($prefix = FALSE) {
267 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'im', $prefix, []);
272 * Returns the list of indices
274 * @param bool $localize
278 public static function indices($localize = TRUE) {
280 'index_location_type' => [
281 'name' => 'index_location_type',
283 0 => 'location_type_id',
285 'localizable' => FALSE,
286 'sig' => 'civicrm_im::0::location_type_id',
288 'UI_provider_id' => [
289 'name' => 'UI_provider_id',
293 'localizable' => FALSE,
294 'sig' => 'civicrm_im::0::provider_id',
296 'index_is_primary' => [
297 'name' => 'index_is_primary',
301 'localizable' => FALSE,
302 'sig' => 'civicrm_im::0::is_primary',
304 'index_is_billing' => [
305 'name' => 'index_is_billing',
309 'localizable' => FALSE,
310 'sig' => 'civicrm_im::0::is_billing',
313 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;