5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Note.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:fd649e023be90204b62cc283886fa400)
13 * Database access object for the Note entity.
15 class CRM_Core_DAO_Note
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_note';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-sticky-note';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
46 * Name of table where item being referenced is stored.
53 * Foreign key to the referenced item.
60 * Note and/or Comment.
67 * FK to Contact ID creator
74 * When was this note last modified/edited
78 public $modified_date;
81 * subject of note description
88 * Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)
97 public function __construct() {
98 $this->__table
= 'civicrm_note';
99 parent
::__construct();
103 * Returns localized title of this entity.
105 public static function getEntityTitle() {
110 * Returns foreign keys and entity references.
113 * [CRM_Core_Reference_Interface]
115 public static function getReferenceColumns() {
116 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
117 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
118 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'contact_id', 'civicrm_contact', 'id');
119 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
120 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
122 return Civi
::$statics[__CLASS__
]['links'];
126 * Returns all the column names of this table
130 public static function &fields() {
131 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
132 Civi
::$statics[__CLASS__
]['fields'] = [
135 'type' => CRM_Utils_Type
::T_INT
,
136 'title' => ts('Note ID'),
137 'description' => ts('Note ID'),
139 'where' => 'civicrm_note.id',
140 'table_name' => 'civicrm_note',
142 'bao' => 'CRM_Core_BAO_Note',
146 'name' => 'entity_table',
147 'type' => CRM_Utils_Type
::T_STRING
,
148 'title' => ts('Note Entity'),
149 'description' => ts('Name of table where item being referenced is stored.'),
152 'size' => CRM_Utils_Type
::BIG
,
153 'where' => 'civicrm_note.entity_table',
154 'table_name' => 'civicrm_note',
156 'bao' => 'CRM_Core_BAO_Note',
158 'pseudoconstant' => [
159 'callback' => 'CRM_Core_BAO_Note::entityTables',
163 'name' => 'entity_id',
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('Note Entity ID'),
166 'description' => ts('Foreign key to the referenced item.'),
168 'where' => 'civicrm_note.entity_id',
169 'table_name' => 'civicrm_note',
171 'bao' => 'CRM_Core_BAO_Note',
176 'type' => CRM_Utils_Type
::T_TEXT
,
177 'title' => ts('Note'),
178 'description' => ts('Note and/or Comment.'),
182 'where' => 'civicrm_note.note',
183 'headerPattern' => '/Note|Comment/i',
184 'dataPattern' => '//',
186 'table_name' => 'civicrm_note',
188 'bao' => 'CRM_Core_BAO_Note',
191 'type' => 'TextArea',
195 'name' => 'contact_id',
196 'type' => CRM_Utils_Type
::T_INT
,
197 'title' => ts('Note Created By'),
198 'description' => ts('FK to Contact ID creator'),
199 'where' => 'civicrm_note.contact_id',
200 'table_name' => 'civicrm_note',
202 'bao' => 'CRM_Core_BAO_Note',
204 'FKClassName' => 'CRM_Contact_DAO_Contact',
207 'name' => 'modified_date',
208 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
209 'title' => ts('Note Modified By'),
210 'description' => ts('When was this note last modified/edited'),
211 'where' => 'civicrm_note.modified_date',
212 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
213 'table_name' => 'civicrm_note',
215 'bao' => 'CRM_Core_BAO_Note',
220 'type' => CRM_Utils_Type
::T_STRING
,
221 'title' => ts('Subject'),
222 'description' => ts('subject of note description'),
225 'where' => 'civicrm_note.subject',
226 'table_name' => 'civicrm_note',
228 'bao' => 'CRM_Core_BAO_Note',
236 'type' => CRM_Utils_Type
::T_STRING
,
237 'title' => ts('Privacy'),
238 'description' => ts('Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)'),
240 'size' => CRM_Utils_Type
::HUGE
,
241 'where' => 'civicrm_note.privacy',
242 'table_name' => 'civicrm_note',
244 'bao' => 'CRM_Core_BAO_Note',
249 'pseudoconstant' => [
250 'optionGroupName' => 'note_privacy',
251 'optionEditPath' => 'civicrm/admin/options/note_privacy',
255 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
257 return Civi
::$statics[__CLASS__
]['fields'];
261 * Return a mapping from field-name to the corresponding key (as used in fields()).
264 * Array(string $name => string $uniqueName).
266 public static function &fieldKeys() {
267 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
268 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
270 return Civi
::$statics[__CLASS__
]['fieldKeys'];
274 * Returns the names of this table
278 public static function getTableName() {
279 return self
::$_tableName;
283 * Returns if this table needs to be logged
287 public function getLog() {
292 * Returns the list of fields that can be imported
294 * @param bool $prefix
298 public static function &import($prefix = FALSE) {
299 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'note', $prefix, []);
304 * Returns the list of fields that can be exported
306 * @param bool $prefix
310 public static function &export($prefix = FALSE) {
311 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'note', $prefix, []);
316 * Returns the list of indices
318 * @param bool $localize
322 public static function indices($localize = TRUE) {
325 'name' => 'index_entity',
330 'localizable' => FALSE,
331 'sig' => 'civicrm_note::0::entity_table::entity_id',
334 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;