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