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