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