Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/Note.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:9f5e4f2a7e73840743efc268ffb4dbfd) |
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 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = TRUE; |
30 | ||
e501603b TO |
31 | /** |
32 | * Note ID | |
33 | * | |
34 | * @var int unsigned | |
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 | * | |
48 | * @var int unsigned | |
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 | * | |
62 | * @var int unsigned | |
63 | */ | |
64 | public $contact_id; | |
c3fc2621 | 65 | |
e501603b TO |
66 | /** |
67 | * When was this note last modified/edited | |
68 | * | |
69 | * @var date | |
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 TO |
102 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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'), |
e501603b | 123 | 'description' => 'Note ID', |
c3fc2621 | 124 | 'required' => TRUE, |
522a26c9 | 125 | 'table_name' => 'civicrm_note', |
126 | 'entity' => 'Note', | |
127 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 128 | 'localizable' => 0, |
c3fc2621 CW |
129 | ], |
130 | 'entity_table' => [ | |
e501603b TO |
131 | 'name' => 'entity_table', |
132 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 133 | 'title' => ts('Note Entity'), |
e501603b | 134 | 'description' => 'Name of table where item being referenced is stored.', |
c3fc2621 | 135 | 'required' => TRUE, |
e501603b TO |
136 | 'maxlength' => 64, |
137 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 138 | 'table_name' => 'civicrm_note', |
139 | 'entity' => 'Note', | |
140 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 141 | 'localizable' => 0, |
c3fc2621 | 142 | 'pseudoconstant' => [ |
e501603b | 143 | 'callback' => 'CRM_Core_BAO_Note::entityTables', |
c3fc2621 CW |
144 | ] |
145 | ], | |
146 | 'entity_id' => [ | |
e501603b TO |
147 | 'name' => 'entity_id', |
148 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 149 | 'title' => ts('Note Entity ID'), |
e501603b | 150 | 'description' => 'Foreign key to the referenced item.', |
c3fc2621 | 151 | 'required' => TRUE, |
522a26c9 | 152 | 'table_name' => 'civicrm_note', |
153 | 'entity' => 'Note', | |
154 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 155 | 'localizable' => 0, |
c3fc2621 CW |
156 | ], |
157 | 'note' => [ | |
e501603b TO |
158 | 'name' => 'note', |
159 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 160 | 'title' => ts('Note'), |
e501603b TO |
161 | 'description' => 'Note and/or Comment.', |
162 | 'rows' => 4, | |
163 | 'cols' => 60, | |
c3fc2621 | 164 | 'import' => TRUE, |
e501603b TO |
165 | 'where' => 'civicrm_note.note', |
166 | 'headerPattern' => '/Note|Comment/i', | |
167 | 'dataPattern' => '//', | |
c3fc2621 | 168 | 'export' => TRUE, |
522a26c9 | 169 | 'table_name' => 'civicrm_note', |
170 | 'entity' => 'Note', | |
171 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 172 | 'localizable' => 0, |
c3fc2621 | 173 | 'html' => [ |
e501603b | 174 | 'type' => 'TextArea', |
c3fc2621 CW |
175 | ], |
176 | ], | |
177 | 'contact_id' => [ | |
e501603b TO |
178 | 'name' => 'contact_id', |
179 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 180 | 'title' => ts('Note Created By'), |
e501603b | 181 | 'description' => 'FK to Contact ID creator', |
522a26c9 | 182 | 'table_name' => 'civicrm_note', |
183 | 'entity' => 'Note', | |
184 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 185 | 'localizable' => 0, |
e501603b | 186 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
187 | ], |
188 | 'modified_date' => [ | |
e501603b TO |
189 | 'name' => 'modified_date', |
190 | 'type' => CRM_Utils_Type::T_DATE, | |
c3fc2621 | 191 | 'title' => ts('Note Modified By'), |
e501603b | 192 | 'description' => 'When was this note last modified/edited', |
522a26c9 | 193 | 'table_name' => 'civicrm_note', |
194 | 'entity' => 'Note', | |
195 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 196 | 'localizable' => 0, |
c3fc2621 CW |
197 | ], |
198 | 'subject' => [ | |
e501603b TO |
199 | 'name' => 'subject', |
200 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 201 | 'title' => ts('Subject'), |
e501603b TO |
202 | 'description' => 'subject of note description', |
203 | 'maxlength' => 255, | |
204 | 'size' => 60, | |
522a26c9 | 205 | 'table_name' => 'civicrm_note', |
206 | 'entity' => 'Note', | |
207 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 208 | 'localizable' => 0, |
c3fc2621 | 209 | 'html' => [ |
e501603b | 210 | 'type' => 'Text', |
c3fc2621 CW |
211 | ], |
212 | ], | |
213 | 'privacy' => [ | |
e501603b TO |
214 | 'name' => 'privacy', |
215 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 216 | 'title' => ts('Privacy'), |
e501603b TO |
217 | 'description' => 'Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)', |
218 | 'maxlength' => 255, | |
219 | 'size' => CRM_Utils_Type::HUGE, | |
522a26c9 | 220 | 'table_name' => 'civicrm_note', |
221 | 'entity' => 'Note', | |
222 | 'bao' => 'CRM_Core_BAO_Note', | |
6a7e5e5d | 223 | 'localizable' => 0, |
c3fc2621 | 224 | 'pseudoconstant' => [ |
e501603b TO |
225 | 'optionGroupName' => 'note_privacy', |
226 | 'optionEditPath' => 'civicrm/admin/options/note_privacy', | |
c3fc2621 CW |
227 | ] |
228 | ], | |
229 | ]; | |
346aaaba | 230 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 231 | } |
346aaaba | 232 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 233 | } |
c3fc2621 | 234 | |
e501603b | 235 | /** |
bd8e0b14 | 236 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
237 | * |
238 | * @return array | |
bd8e0b14 | 239 | * Array(string $name => string $uniqueName). |
e501603b | 240 | */ |
c3fc2621 | 241 | public static function &fieldKeys() { |
bd8e0b14 TO |
242 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
243 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 244 | } |
bd8e0b14 | 245 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 246 | } |
c3fc2621 | 247 | |
e501603b TO |
248 | /** |
249 | * Returns the names of this table | |
250 | * | |
251 | * @return string | |
252 | */ | |
c3fc2621 | 253 | public static function getTableName() { |
e501603b TO |
254 | return self::$_tableName; |
255 | } | |
c3fc2621 | 256 | |
e501603b TO |
257 | /** |
258 | * Returns if this table needs to be logged | |
259 | * | |
c3fc2621 | 260 | * @return bool |
e501603b | 261 | */ |
c3fc2621 | 262 | public function getLog() { |
e501603b TO |
263 | return self::$_log; |
264 | } | |
c3fc2621 | 265 | |
e501603b TO |
266 | /** |
267 | * Returns the list of fields that can be imported | |
268 | * | |
269 | * @param bool $prefix | |
270 | * | |
271 | * @return array | |
272 | */ | |
c3fc2621 CW |
273 | public static function &import($prefix = FALSE) { |
274 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'note', $prefix, []); | |
60808919 | 275 | return $r; |
e501603b | 276 | } |
c3fc2621 | 277 | |
e501603b TO |
278 | /** |
279 | * Returns the list of fields that can be exported | |
280 | * | |
281 | * @param bool $prefix | |
282 | * | |
283 | * @return array | |
284 | */ | |
c3fc2621 CW |
285 | public static function &export($prefix = FALSE) { |
286 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'note', $prefix, []); | |
60808919 | 287 | return $r; |
e501603b | 288 | } |
c3fc2621 | 289 | |
e7a6b91a AS |
290 | /** |
291 | * Returns the list of indices | |
c3fc2621 CW |
292 | * |
293 | * @param bool $localize | |
294 | * | |
295 | * @return array | |
e7a6b91a AS |
296 | */ |
297 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
298 | $indices = [ |
299 | 'index_entity' => [ | |
e7a6b91a | 300 | 'name' => 'index_entity', |
c3fc2621 | 301 | 'field' => [ |
e7a6b91a AS |
302 | 0 => 'entity_table', |
303 | 1 => 'entity_id', | |
c3fc2621 CW |
304 | ], |
305 | 'localizable' => FALSE, | |
e7a6b91a | 306 | 'sig' => 'civicrm_note::0::entity_table::entity_id', |
c3fc2621 CW |
307 | ], |
308 | ]; | |
e7a6b91a AS |
309 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
310 | } | |
c3fc2621 | 311 | |
e501603b | 312 | } |