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:0e43e07bfbf7de4e7fa48f4d24a923fd)
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',
147 'name' => 'entity_table',
148 'type' => CRM_Utils_Type
::T_STRING
,
149 'title' => ts('Note Entity'),
150 'description' => ts('Name of table where item being referenced is stored.'),
153 'size' => CRM_Utils_Type
::BIG
,
154 'where' => 'civicrm_note.entity_table',
155 'table_name' => 'civicrm_note',
157 'bao' => 'CRM_Core_BAO_Note',
159 'pseudoconstant' => [
160 'callback' => 'CRM_Core_BAO_Note::entityTables',
165 'name' => 'entity_id',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Note Entity ID'),
168 'description' => ts('Foreign key to the referenced item.'),
170 'where' => 'civicrm_note.entity_id',
171 'table_name' => 'civicrm_note',
173 'bao' => 'CRM_Core_BAO_Note',
179 'type' => CRM_Utils_Type
::T_TEXT
,
180 'title' => ts('Note'),
181 'description' => ts('Note and/or Comment.'),
185 'where' => 'civicrm_note.note',
186 'headerPattern' => '/Note|Comment/i',
187 'dataPattern' => '//',
189 'table_name' => 'civicrm_note',
191 'bao' => 'CRM_Core_BAO_Note',
194 'type' => 'TextArea',
199 'name' => 'contact_id',
200 'type' => CRM_Utils_Type
::T_INT
,
201 'title' => ts('Note Created By'),
202 'description' => ts('FK to Contact ID creator'),
203 'where' => 'civicrm_note.contact_id',
204 'table_name' => 'civicrm_note',
206 'bao' => 'CRM_Core_BAO_Note',
208 'FKClassName' => 'CRM_Contact_DAO_Contact',
212 'name' => 'modified_date',
213 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
214 'title' => ts('Note Modified By'),
215 'description' => ts('When was this note last modified/edited'),
216 'where' => 'civicrm_note.modified_date',
217 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
218 'table_name' => 'civicrm_note',
220 'bao' => 'CRM_Core_BAO_Note',
226 'type' => CRM_Utils_Type
::T_STRING
,
227 'title' => ts('Subject'),
228 'description' => ts('subject of note description'),
231 'where' => 'civicrm_note.subject',
232 'table_name' => 'civicrm_note',
234 'bao' => 'CRM_Core_BAO_Note',
243 'type' => CRM_Utils_Type
::T_STRING
,
244 'title' => ts('Privacy'),
245 'description' => ts('Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)'),
247 'size' => CRM_Utils_Type
::HUGE
,
248 'where' => 'civicrm_note.privacy',
249 'table_name' => 'civicrm_note',
251 'bao' => 'CRM_Core_BAO_Note',
256 'pseudoconstant' => [
257 'optionGroupName' => 'note_privacy',
258 'optionEditPath' => 'civicrm/admin/options/note_privacy',
263 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
265 return Civi
::$statics[__CLASS__
]['fields'];
269 * Return a mapping from field-name to the corresponding key (as used in fields()).
272 * Array(string $name => string $uniqueName).
274 public static function &fieldKeys() {
275 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
276 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
278 return Civi
::$statics[__CLASS__
]['fieldKeys'];
282 * Returns the names of this table
286 public static function getTableName() {
287 return self
::$_tableName;
291 * Returns if this table needs to be logged
295 public function getLog() {
300 * Returns the list of fields that can be imported
302 * @param bool $prefix
306 public static function &import($prefix = FALSE) {
307 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'note', $prefix, []);
312 * Returns the list of fields that can be exported
314 * @param bool $prefix
318 public static function &export($prefix = FALSE) {
319 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'note', $prefix, []);
324 * Returns the list of indices
326 * @param bool $localize
330 public static function indices($localize = TRUE) {
333 'name' => 'index_entity',
338 'localizable' => FALSE,
339 'sig' => 'civicrm_note::0::entity_table::entity_id',
342 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;