Commit | Line | Data |
---|---|---|
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/Core/Note.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
95ae25b9 | 9 | * (GenCodeChecksum:7a58bb39022811ac55bfaed58c241487) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Note entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Note 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_note'; |
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 = TRUE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * Note ID | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * Name of table where item being referenced is stored. | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $entity_table; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Foreign key to the referenced item. | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $entity_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * Note and/or Comment. | |
54 | * | |
55 | * @var text | |
56 | */ | |
57 | public $note; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * FK to Contact ID creator | |
61 | * | |
e6ca0a57 | 62 | * @var int |
e501603b TO |
63 | */ |
64 | public $contact_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * When was this note last modified/edited | |
68 | * | |
95ae25b9 | 69 | * @var timestamp |
e501603b TO |
70 | */ |
71 | public $modified_date; | |
c3fc2621 | 72 | |
e501603b TO |
73 | /** |
74 | * subject of note description | |
75 | * | |
76 | * @var string | |
77 | */ | |
78 | public $subject; | |
c3fc2621 | 79 | |
e501603b TO |
80 | /** |
81 | * Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK) | |
82 | * | |
83 | * @var string | |
84 | */ | |
85 | public $privacy; | |
c3fc2621 | 86 | |
e501603b | 87 | /** |
f41f0342 | 88 | * Class constructor. |
e501603b | 89 | */ |
c3fc2621 | 90 | public function __construct() { |
e501603b TO |
91 | $this->__table = 'civicrm_note'; |
92 | parent::__construct(); | |
93 | } | |
c3fc2621 | 94 | |
e501603b | 95 | /** |
f41f0342 | 96 | * Returns foreign keys and entity references. |
e501603b TO |
97 | * |
98 | * @return array | |
99 | * [CRM_Core_Reference_Interface] | |
100 | */ | |
c3fc2621 | 101 | public static function getReferenceColumns() { |
346aaaba | 102 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 103 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
104 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id'); |
105 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 106 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 107 | } |
346aaaba | 108 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 109 | } |
c3fc2621 | 110 | |
e501603b TO |
111 | /** |
112 | * Returns all the column names of this table | |
113 | * | |
114 | * @return array | |
115 | */ | |
c3fc2621 | 116 | public static function &fields() { |
346aaaba | 117 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
118 | Civi::$statics[__CLASS__]['fields'] = [ |
119 | 'id' => [ | |
e501603b TO |
120 | 'name' => 'id', |
121 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 122 | 'title' => ts('Note ID'), |
215b423e | 123 | 'description' => ts('Note ID'), |
c3fc2621 | 124 | 'required' => TRUE, |
a36434b9 | 125 | 'where' => 'civicrm_note.id', |
522a26c9 | 126 | 'table_name' => 'civicrm_note', |
127 | 'entity' => 'Note', | |
128 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 129 | 'localizable' => 0, |
c3fc2621 CW |
130 | ], |
131 | 'entity_table' => [ | |
e501603b TO |
132 | 'name' => 'entity_table', |
133 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 134 | 'title' => ts('Note Entity'), |
215b423e | 135 | 'description' => ts('Name of table where item being referenced is stored.'), |
c3fc2621 | 136 | 'required' => TRUE, |
e501603b TO |
137 | 'maxlength' => 64, |
138 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 139 | 'where' => 'civicrm_note.entity_table', |
522a26c9 | 140 | 'table_name' => 'civicrm_note', |
141 | 'entity' => 'Note', | |
142 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 143 | 'localizable' => 0, |
c3fc2621 | 144 | 'pseudoconstant' => [ |
e501603b | 145 | 'callback' => 'CRM_Core_BAO_Note::entityTables', |
e6ca0a57 | 146 | ], |
c3fc2621 CW |
147 | ], |
148 | 'entity_id' => [ | |
e501603b TO |
149 | 'name' => 'entity_id', |
150 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 151 | 'title' => ts('Note Entity ID'), |
215b423e | 152 | 'description' => ts('Foreign key to the referenced item.'), |
c3fc2621 | 153 | 'required' => TRUE, |
a36434b9 | 154 | 'where' => 'civicrm_note.entity_id', |
522a26c9 | 155 | 'table_name' => 'civicrm_note', |
156 | 'entity' => 'Note', | |
157 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 158 | 'localizable' => 0, |
c3fc2621 CW |
159 | ], |
160 | 'note' => [ | |
e501603b TO |
161 | 'name' => 'note', |
162 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 163 | 'title' => ts('Note'), |
215b423e | 164 | 'description' => ts('Note and/or Comment.'), |
e501603b TO |
165 | 'rows' => 4, |
166 | 'cols' => 60, | |
c3fc2621 | 167 | 'import' => TRUE, |
e501603b TO |
168 | 'where' => 'civicrm_note.note', |
169 | 'headerPattern' => '/Note|Comment/i', | |
170 | 'dataPattern' => '//', | |
c3fc2621 | 171 | 'export' => TRUE, |
522a26c9 | 172 | 'table_name' => 'civicrm_note', |
173 | 'entity' => 'Note', | |
174 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 175 | 'localizable' => 0, |
c3fc2621 | 176 | 'html' => [ |
e501603b | 177 | 'type' => 'TextArea', |
c3fc2621 CW |
178 | ], |
179 | ], | |
180 | 'contact_id' => [ | |
e501603b TO |
181 | 'name' => 'contact_id', |
182 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 183 | 'title' => ts('Note Created By'), |
215b423e | 184 | 'description' => ts('FK to Contact ID creator'), |
a36434b9 | 185 | 'where' => 'civicrm_note.contact_id', |
522a26c9 | 186 | 'table_name' => 'civicrm_note', |
187 | 'entity' => 'Note', | |
188 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 189 | 'localizable' => 0, |
e501603b | 190 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
191 | ], |
192 | 'modified_date' => [ | |
e501603b | 193 | 'name' => 'modified_date', |
95ae25b9 | 194 | 'type' => CRM_Utils_Type::T_TIMESTAMP, |
c3fc2621 | 195 | 'title' => ts('Note Modified By'), |
215b423e | 196 | 'description' => ts('When was this note last modified/edited'), |
a36434b9 | 197 | 'where' => 'civicrm_note.modified_date', |
95ae25b9 | 198 | 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', |
522a26c9 | 199 | 'table_name' => 'civicrm_note', |
200 | 'entity' => 'Note', | |
201 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 202 | 'localizable' => 0, |
c3fc2621 CW |
203 | ], |
204 | 'subject' => [ | |
e501603b TO |
205 | 'name' => 'subject', |
206 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 207 | 'title' => ts('Subject'), |
215b423e | 208 | 'description' => ts('subject of note description'), |
e501603b TO |
209 | 'maxlength' => 255, |
210 | 'size' => 60, | |
a36434b9 | 211 | 'where' => 'civicrm_note.subject', |
522a26c9 | 212 | 'table_name' => 'civicrm_note', |
213 | 'entity' => 'Note', | |
214 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 215 | 'localizable' => 0, |
c3fc2621 | 216 | 'html' => [ |
e501603b | 217 | 'type' => 'Text', |
c3fc2621 CW |
218 | ], |
219 | ], | |
220 | 'privacy' => [ | |
e501603b TO |
221 | 'name' => 'privacy', |
222 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 223 | 'title' => ts('Privacy'), |
215b423e | 224 | 'description' => ts('Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)'), |
e501603b TO |
225 | 'maxlength' => 255, |
226 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 227 | 'where' => 'civicrm_note.privacy', |
522a26c9 | 228 | 'table_name' => 'civicrm_note', |
229 | 'entity' => 'Note', | |
230 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 231 | 'localizable' => 0, |
afbbfe95 PN |
232 | 'html' => [ |
233 | 'type' => 'Select', | |
234 | ], | |
c3fc2621 | 235 | 'pseudoconstant' => [ |
e501603b TO |
236 | 'optionGroupName' => 'note_privacy', |
237 | 'optionEditPath' => 'civicrm/admin/options/note_privacy', | |
e6ca0a57 | 238 | ], |
c3fc2621 CW |
239 | ], |
240 | ]; | |
346aaaba | 241 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 242 | } |
346aaaba | 243 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 244 | } |
c3fc2621 | 245 | |
e501603b | 246 | /** |
bd8e0b14 | 247 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
248 | * |
249 | * @return array | |
bd8e0b14 | 250 | * Array(string $name => string $uniqueName). |
e501603b | 251 | */ |
c3fc2621 | 252 | public static function &fieldKeys() { |
bd8e0b14 TO |
253 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
254 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 255 | } |
bd8e0b14 | 256 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 257 | } |
c3fc2621 | 258 | |
e501603b TO |
259 | /** |
260 | * Returns the names of this table | |
261 | * | |
262 | * @return string | |
263 | */ | |
c3fc2621 | 264 | public static function getTableName() { |
e501603b TO |
265 | return self::$_tableName; |
266 | } | |
c3fc2621 | 267 | |
e501603b TO |
268 | /** |
269 | * Returns if this table needs to be logged | |
270 | * | |
c3fc2621 | 271 | * @return bool |
e501603b | 272 | */ |
c3fc2621 | 273 | public function getLog() { |
e501603b TO |
274 | return self::$_log; |
275 | } | |
c3fc2621 | 276 | |
e501603b TO |
277 | /** |
278 | * Returns the list of fields that can be imported | |
279 | * | |
280 | * @param bool $prefix | |
281 | * | |
282 | * @return array | |
283 | */ | |
c3fc2621 CW |
284 | public static function &import($prefix = FALSE) { |
285 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'note', $prefix, []); | |
60808919 | 286 | return $r; |
e501603b | 287 | } |
c3fc2621 | 288 | |
e501603b TO |
289 | /** |
290 | * Returns the list of fields that can be exported | |
291 | * | |
292 | * @param bool $prefix | |
293 | * | |
294 | * @return array | |
295 | */ | |
c3fc2621 CW |
296 | public static function &export($prefix = FALSE) { |
297 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'note', $prefix, []); | |
60808919 | 298 | return $r; |
e501603b | 299 | } |
c3fc2621 | 300 | |
e7a6b91a AS |
301 | /** |
302 | * Returns the list of indices | |
c3fc2621 CW |
303 | * |
304 | * @param bool $localize | |
305 | * | |
306 | * @return array | |
e7a6b91a AS |
307 | */ |
308 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
309 | $indices = [ |
310 | 'index_entity' => [ | |
e7a6b91a | 311 | 'name' => 'index_entity', |
c3fc2621 | 312 | 'field' => [ |
e7a6b91a AS |
313 | 0 => 'entity_table', |
314 | 1 => 'entity_id', | |
c3fc2621 CW |
315 | ], |
316 | 'localizable' => FALSE, | |
e7a6b91a | 317 | 'sig' => 'civicrm_note::0::entity_table::entity_id', |
c3fc2621 CW |
318 | ], |
319 | ]; | |
e7a6b91a AS |
320 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
321 | } | |
c3fc2621 | 322 | |
e501603b | 323 | } |