Merge pull request #18148 from civicrm/5.29
[civicrm-core.git] / CRM / Contact / DAO / DashboardContact.php
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:67153c09e74eda2febf15986f9c04439)
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 public static function getEntityTitle() {
85 return ts('Dashboard Contacts');
86 }
87
88 /**
89 * Returns foreign keys and entity references.
90 *
91 * @return array
92 * [CRM_Core_Reference_Interface]
93 */
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(), 'dashboard_id', 'civicrm_dashboard', 'id');
98 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
99 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
100 }
101 return Civi::$statics[__CLASS__]['links'];
102 }
103
104 /**
105 * Returns all the column names of this table
106 *
107 * @return array
108 */
109 public static function &fields() {
110 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
111 Civi::$statics[__CLASS__]['fields'] = [
112 'id' => [
113 'name' => 'id',
114 'type' => CRM_Utils_Type::T_INT,
115 'title' => ts('Dashboard Contact ID'),
116 'required' => TRUE,
117 'where' => 'civicrm_dashboard_contact.id',
118 'table_name' => 'civicrm_dashboard_contact',
119 'entity' => 'DashboardContact',
120 'bao' => 'CRM_Contact_BAO_DashboardContact',
121 'localizable' => 0,
122 'add' => '3.1',
123 ],
124 'dashboard_id' => [
125 'name' => 'dashboard_id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Dashboard'),
128 'description' => ts('Dashboard ID'),
129 'required' => TRUE,
130 'where' => 'civicrm_dashboard_contact.dashboard_id',
131 'table_name' => 'civicrm_dashboard_contact',
132 'entity' => 'DashboardContact',
133 'bao' => 'CRM_Contact_BAO_DashboardContact',
134 'localizable' => 0,
135 'FKClassName' => 'CRM_Core_DAO_Dashboard',
136 'add' => '3.1',
137 ],
138 'contact_id' => [
139 'name' => 'contact_id',
140 'type' => CRM_Utils_Type::T_INT,
141 'title' => ts('Dashboard Contact'),
142 'description' => ts('Contact ID'),
143 'required' => TRUE,
144 'where' => 'civicrm_dashboard_contact.contact_id',
145 'table_name' => 'civicrm_dashboard_contact',
146 'entity' => 'DashboardContact',
147 'bao' => 'CRM_Contact_BAO_DashboardContact',
148 'localizable' => 0,
149 'FKClassName' => 'CRM_Contact_DAO_Contact',
150 'add' => '3.1',
151 ],
152 'column_no' => [
153 'name' => 'column_no',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Column No'),
156 'description' => ts('column no for this widget'),
157 'where' => 'civicrm_dashboard_contact.column_no',
158 'default' => '0',
159 'table_name' => 'civicrm_dashboard_contact',
160 'entity' => 'DashboardContact',
161 'bao' => 'CRM_Contact_BAO_DashboardContact',
162 'localizable' => 0,
163 'add' => '3.1',
164 ],
165 'is_active' => [
166 'name' => 'is_active',
167 'type' => CRM_Utils_Type::T_BOOLEAN,
168 'title' => ts('Dashlet is Active?'),
169 'description' => ts('Is this widget active?'),
170 'where' => 'civicrm_dashboard_contact.is_active',
171 'default' => '0',
172 'table_name' => 'civicrm_dashboard_contact',
173 'entity' => 'DashboardContact',
174 'bao' => 'CRM_Contact_BAO_DashboardContact',
175 'localizable' => 0,
176 'add' => '3.1',
177 ],
178 'weight' => [
179 'name' => 'weight',
180 'type' => CRM_Utils_Type::T_INT,
181 'title' => ts('Order'),
182 'description' => ts('Ordering of the widgets.'),
183 'where' => 'civicrm_dashboard_contact.weight',
184 'default' => '0',
185 'table_name' => 'civicrm_dashboard_contact',
186 'entity' => 'DashboardContact',
187 'bao' => 'CRM_Contact_BAO_DashboardContact',
188 'localizable' => 0,
189 'add' => '3.1',
190 ],
191 ];
192 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
193 }
194 return Civi::$statics[__CLASS__]['fields'];
195 }
196
197 /**
198 * Return a mapping from field-name to the corresponding key (as used in fields()).
199 *
200 * @return array
201 * Array(string $name => string $uniqueName).
202 */
203 public static function &fieldKeys() {
204 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
205 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
206 }
207 return Civi::$statics[__CLASS__]['fieldKeys'];
208 }
209
210 /**
211 * Returns the names of this table
212 *
213 * @return string
214 */
215 public static function getTableName() {
216 return self::$_tableName;
217 }
218
219 /**
220 * Returns if this table needs to be logged
221 *
222 * @return bool
223 */
224 public function getLog() {
225 return self::$_log;
226 }
227
228 /**
229 * Returns the list of fields that can be imported
230 *
231 * @param bool $prefix
232 *
233 * @return array
234 */
235 public static function &import($prefix = FALSE) {
236 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dashboard_contact', $prefix, []);
237 return $r;
238 }
239
240 /**
241 * Returns the list of fields that can be exported
242 *
243 * @param bool $prefix
244 *
245 * @return array
246 */
247 public static function &export($prefix = FALSE) {
248 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dashboard_contact', $prefix, []);
249 return $r;
250 }
251
252 /**
253 * Returns the list of indices
254 *
255 * @param bool $localize
256 *
257 * @return array
258 */
259 public static function indices($localize = TRUE) {
260 $indices = [
261 'index_dashboard_id_contact_id' => [
262 'name' => 'index_dashboard_id_contact_id',
263 'field' => [
264 0 => 'dashboard_id',
265 1 => 'contact_id',
266 ],
267 'localizable' => FALSE,
268 'unique' => TRUE,
269 'sig' => 'civicrm_dashboard_contact::1::dashboard_id::contact_id',
270 ],
271 ];
272 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
273 }
274
275 }