5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/IM.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:5a7b60741331c475603af3bb180d2bd7)
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('Is IM Primary?'),
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',
205 'name' => 'is_billing',
206 'type' => CRM_Utils_Type
::T_BOOLEAN
,
207 'title' => ts('Is IM Billing?'),
208 'description' => ts('Is this the billing?'),
209 'where' => 'civicrm_im.is_billing',
211 'table_name' => 'civicrm_im',
213 'bao' => 'CRM_Core_BAO_IM',
217 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
219 return Civi
::$statics[__CLASS__
]['fields'];
223 * Return a mapping from field-name to the corresponding key (as used in fields()).
226 * Array(string $name => string $uniqueName).
228 public static function &fieldKeys() {
229 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
230 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
232 return Civi
::$statics[__CLASS__
]['fieldKeys'];
236 * Returns the names of this table
240 public static function getTableName() {
241 return self
::$_tableName;
245 * Returns if this table needs to be logged
249 public function getLog() {
254 * Returns the list of fields that can be imported
256 * @param bool $prefix
260 public static function &import($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'im', $prefix, []);
266 * Returns the list of fields that can be exported
268 * @param bool $prefix
272 public static function &export($prefix = FALSE) {
273 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'im', $prefix, []);
278 * Returns the list of indices
280 * @param bool $localize
284 public static function indices($localize = TRUE) {
286 'index_location_type' => [
287 'name' => 'index_location_type',
289 0 => 'location_type_id',
291 'localizable' => FALSE,
292 'sig' => 'civicrm_im::0::location_type_id',
294 'UI_provider_id' => [
295 'name' => 'UI_provider_id',
299 'localizable' => FALSE,
300 'sig' => 'civicrm_im::0::provider_id',
302 'index_is_primary' => [
303 'name' => 'index_is_primary',
307 'localizable' => FALSE,
308 'sig' => 'civicrm_im::0::is_primary',
310 'index_is_billing' => [
311 'name' => 'index_is_billing',
315 'localizable' => FALSE,
316 'sig' => 'civicrm_im::0::is_billing',
319 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;