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