| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Activity/ActivityContact.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:b458f04c2195968dbc9d49f35f7abb70) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the ActivityContact entity. |
| 14 | */ |
| 15 | class CRM_Activity_DAO_ActivityContact extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public static $_tableName = 'civicrm_activity_contact'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | public static $_log = TRUE; |
| 30 | |
| 31 | /** |
| 32 | * Activity contact id |
| 33 | * |
| 34 | * @var int |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * Foreign key to the activity for this record. |
| 40 | * |
| 41 | * @var int |
| 42 | */ |
| 43 | public $activity_id; |
| 44 | |
| 45 | /** |
| 46 | * Foreign key to the contact for this record. |
| 47 | * |
| 48 | * @var int |
| 49 | */ |
| 50 | public $contact_id; |
| 51 | |
| 52 | /** |
| 53 | * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target. |
| 54 | * |
| 55 | * @var int |
| 56 | */ |
| 57 | public $record_type_id; |
| 58 | |
| 59 | /** |
| 60 | * Class constructor. |
| 61 | */ |
| 62 | public function __construct() { |
| 63 | $this->__table = 'civicrm_activity_contact'; |
| 64 | parent::__construct(); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Returns localized title of this entity. |
| 69 | */ |
| 70 | public static function getEntityTitle() { |
| 71 | return ts('Activity Contacts'); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Returns foreign keys and entity references. |
| 76 | * |
| 77 | * @return array |
| 78 | * [CRM_Core_Reference_Interface] |
| 79 | */ |
| 80 | public static function getReferenceColumns() { |
| 81 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
| 82 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
| 83 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'activity_id', 'civicrm_activity', 'id'); |
| 84 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
| 85 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
| 86 | } |
| 87 | return Civi::$statics[__CLASS__]['links']; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Returns all the column names of this table |
| 92 | * |
| 93 | * @return array |
| 94 | */ |
| 95 | public static function &fields() { |
| 96 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 97 | Civi::$statics[__CLASS__]['fields'] = [ |
| 98 | 'id' => [ |
| 99 | 'name' => 'id', |
| 100 | 'type' => CRM_Utils_Type::T_INT, |
| 101 | 'title' => ts('Activity Contact ID'), |
| 102 | 'description' => ts('Activity contact id'), |
| 103 | 'required' => TRUE, |
| 104 | 'where' => 'civicrm_activity_contact.id', |
| 105 | 'table_name' => 'civicrm_activity_contact', |
| 106 | 'entity' => 'ActivityContact', |
| 107 | 'bao' => 'CRM_Activity_BAO_ActivityContact', |
| 108 | 'localizable' => 0, |
| 109 | 'add' => '4.4', |
| 110 | ], |
| 111 | 'activity_id' => [ |
| 112 | 'name' => 'activity_id', |
| 113 | 'type' => CRM_Utils_Type::T_INT, |
| 114 | 'title' => ts('Activity ID'), |
| 115 | 'description' => ts('Foreign key to the activity for this record.'), |
| 116 | 'required' => TRUE, |
| 117 | 'where' => 'civicrm_activity_contact.activity_id', |
| 118 | 'table_name' => 'civicrm_activity_contact', |
| 119 | 'entity' => 'ActivityContact', |
| 120 | 'bao' => 'CRM_Activity_BAO_ActivityContact', |
| 121 | 'localizable' => 0, |
| 122 | 'FKClassName' => 'CRM_Activity_DAO_Activity', |
| 123 | 'add' => '4.4', |
| 124 | ], |
| 125 | 'contact_id' => [ |
| 126 | 'name' => 'contact_id', |
| 127 | 'type' => CRM_Utils_Type::T_INT, |
| 128 | 'title' => ts('Contact ID (match to contact)'), |
| 129 | 'description' => ts('Foreign key to the contact for this record.'), |
| 130 | 'required' => TRUE, |
| 131 | 'import' => TRUE, |
| 132 | 'where' => 'civicrm_activity_contact.contact_id', |
| 133 | 'export' => TRUE, |
| 134 | 'table_name' => 'civicrm_activity_contact', |
| 135 | 'entity' => 'ActivityContact', |
| 136 | 'bao' => 'CRM_Activity_BAO_ActivityContact', |
| 137 | 'localizable' => 0, |
| 138 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
| 139 | 'add' => '4.4', |
| 140 | ], |
| 141 | 'record_type_id' => [ |
| 142 | 'name' => 'record_type_id', |
| 143 | 'type' => CRM_Utils_Type::T_INT, |
| 144 | 'title' => ts('Record Type ID'), |
| 145 | 'description' => ts('Nature of this contact\'s role in the activity: 1 assignee, 2 creator, 3 focus or target.'), |
| 146 | 'where' => 'civicrm_activity_contact.record_type_id', |
| 147 | 'table_name' => 'civicrm_activity_contact', |
| 148 | 'entity' => 'ActivityContact', |
| 149 | 'bao' => 'CRM_Activity_BAO_ActivityContact', |
| 150 | 'localizable' => 0, |
| 151 | 'html' => [ |
| 152 | 'type' => 'Select', |
| 153 | ], |
| 154 | 'pseudoconstant' => [ |
| 155 | 'optionGroupName' => 'activity_contacts', |
| 156 | 'optionEditPath' => 'civicrm/admin/options/activity_contacts', |
| 157 | ], |
| 158 | 'add' => '4.4', |
| 159 | ], |
| 160 | ]; |
| 161 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 162 | } |
| 163 | return Civi::$statics[__CLASS__]['fields']; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 168 | * |
| 169 | * @return array |
| 170 | * Array(string $name => string $uniqueName). |
| 171 | */ |
| 172 | public static function &fieldKeys() { |
| 173 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 174 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 175 | } |
| 176 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Returns the names of this table |
| 181 | * |
| 182 | * @return string |
| 183 | */ |
| 184 | public static function getTableName() { |
| 185 | return self::$_tableName; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Returns if this table needs to be logged |
| 190 | * |
| 191 | * @return bool |
| 192 | */ |
| 193 | public function getLog() { |
| 194 | return self::$_log; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Returns the list of fields that can be imported |
| 199 | * |
| 200 | * @param bool $prefix |
| 201 | * |
| 202 | * @return array |
| 203 | */ |
| 204 | public static function &import($prefix = FALSE) { |
| 205 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'activity_contact', $prefix, []); |
| 206 | return $r; |
| 207 | } |
| 208 | |
| 209 | /** |
| 210 | * Returns the list of fields that can be exported |
| 211 | * |
| 212 | * @param bool $prefix |
| 213 | * |
| 214 | * @return array |
| 215 | */ |
| 216 | public static function &export($prefix = FALSE) { |
| 217 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'activity_contact', $prefix, []); |
| 218 | return $r; |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Returns the list of indices |
| 223 | * |
| 224 | * @param bool $localize |
| 225 | * |
| 226 | * @return array |
| 227 | */ |
| 228 | public static function indices($localize = TRUE) { |
| 229 | $indices = [ |
| 230 | 'UI_activity_contact' => [ |
| 231 | 'name' => 'UI_activity_contact', |
| 232 | 'field' => [ |
| 233 | 0 => 'contact_id', |
| 234 | 1 => 'activity_id', |
| 235 | 2 => 'record_type_id', |
| 236 | ], |
| 237 | 'localizable' => FALSE, |
| 238 | 'unique' => TRUE, |
| 239 | 'sig' => 'civicrm_activity_contact::1::contact_id::activity_id::record_type_id', |
| 240 | ], |
| 241 | 'index_record_type' => [ |
| 242 | 'name' => 'index_record_type', |
| 243 | 'field' => [ |
| 244 | 0 => 'activity_id', |
| 245 | 1 => 'record_type_id', |
| 246 | ], |
| 247 | 'localizable' => FALSE, |
| 248 | 'sig' => 'civicrm_activity_contact::0::activity_id::record_type_id', |
| 249 | ], |
| 250 | ]; |
| 251 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 252 | } |
| 253 | |
| 254 | } |