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