5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/IM.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9ea5d47a6892a28874a633ca8c5ef92c)
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 public static $_tableName = 'civicrm_im';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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 'where' => 'civicrm_im.id',
118 'table_name' => 'civicrm_im',
120 'bao' => 'CRM_Core_BAO_IM',
124 'name' => 'contact_id',
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('IM Contact'),
127 'description' => ts('FK to Contact ID'),
128 'where' => 'civicrm_im.contact_id',
129 'table_name' => 'civicrm_im',
131 'bao' => 'CRM_Core_BAO_IM',
133 'FKClassName' => 'CRM_Contact_DAO_Contact',
135 'location_type_id' => [
136 'name' => 'location_type_id',
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('IM Location Type'),
139 'description' => ts('Which Location does this email belong to.'),
140 'where' => 'civicrm_im.location_type_id',
141 'table_name' => 'civicrm_im',
143 'bao' => 'CRM_Core_BAO_IM',
148 'pseudoconstant' => [
149 'table' => 'civicrm_location_type',
151 'labelColumn' => 'display_name',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('IM Screen Name'),
158 'description' => ts('IM screen name'),
160 'size' => CRM_Utils_Type
::BIG
,
162 'where' => 'civicrm_im.name',
163 'headerPattern' => '/I(nstant )?M(ess.*)?|screen(\s+)?name/i',
164 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
166 'table_name' => 'civicrm_im',
168 'bao' => 'CRM_Core_BAO_IM',
175 'name' => 'provider_id',
176 'type' => CRM_Utils_Type
::T_INT
,
177 'title' => ts('IM Provider'),
178 'description' => ts('Which IM Provider does this screen name belong to.'),
179 'where' => 'civicrm_im.provider_id',
180 'table_name' => 'civicrm_im',
182 'bao' => 'CRM_Core_BAO_IM',
187 'pseudoconstant' => [
188 'optionGroupName' => 'instant_messenger_service',
189 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service',
193 'name' => 'is_primary',
194 'type' => CRM_Utils_Type
::T_BOOLEAN
,
195 'title' => ts('Primary IM'),
196 'description' => ts('Is this the primary IM for this contact and location.'),
197 'where' => 'civicrm_im.is_primary',
199 'table_name' => 'civicrm_im',
201 'bao' => 'CRM_Core_BAO_IM',
208 'name' => 'is_billing',
209 'type' => CRM_Utils_Type
::T_BOOLEAN
,
210 'title' => ts('Is IM Billing?'),
211 'description' => ts('Is this the billing?'),
212 'where' => 'civicrm_im.is_billing',
214 'table_name' => 'civicrm_im',
216 'bao' => 'CRM_Core_BAO_IM',
220 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
222 return Civi
::$statics[__CLASS__
]['fields'];
226 * Return a mapping from field-name to the corresponding key (as used in fields()).
229 * Array(string $name => string $uniqueName).
231 public static function &fieldKeys() {
232 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
233 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
235 return Civi
::$statics[__CLASS__
]['fieldKeys'];
239 * Returns the names of this table
243 public static function getTableName() {
244 return self
::$_tableName;
248 * Returns if this table needs to be logged
252 public function getLog() {
257 * Returns the list of fields that can be imported
259 * @param bool $prefix
263 public static function &import($prefix = FALSE) {
264 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'im', $prefix, []);
269 * Returns the list of fields that can be exported
271 * @param bool $prefix
275 public static function &export($prefix = FALSE) {
276 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'im', $prefix, []);
281 * Returns the list of indices
283 * @param bool $localize
287 public static function indices($localize = TRUE) {
289 'index_location_type' => [
290 'name' => 'index_location_type',
292 0 => 'location_type_id',
294 'localizable' => FALSE,
295 'sig' => 'civicrm_im::0::location_type_id',
297 'UI_provider_id' => [
298 'name' => 'UI_provider_id',
302 'localizable' => FALSE,
303 'sig' => 'civicrm_im::0::provider_id',
305 'index_is_primary' => [
306 'name' => 'index_is_primary',
310 'localizable' => FALSE,
311 'sig' => 'civicrm_im::0::is_primary',
313 'index_is_billing' => [
314 'name' => 'index_is_billing',
318 'localizable' => FALSE,
319 'sig' => 'civicrm_im::0::is_billing',
322 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;