5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/Note.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4809780ce0ff76ab175d5a8e338063e1)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * Name of table where item being referenced is stored.
46 * Foreign key to the referenced item.
53 * Note and/or Comment.
60 * FK to Contact ID creator
67 * When was this note last modified/edited
71 public $modified_date;
74 * subject of note description
81 * Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)
90 public function __construct() {
91 $this->__table
= 'civicrm_note';
92 parent
::__construct();
96 * Returns foreign keys and entity references.
99 * [CRM_Core_Reference_Interface]
101 public static function getReferenceColumns() {
102 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
103 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
106 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
108 return Civi
::$statics[__CLASS__
]['links'];
112 * Returns all the column names of this table
116 public static function &fields() {
117 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
118 Civi
::$statics[__CLASS__
]['fields'] = [
121 'type' => CRM_Utils_Type
::T_INT
,
122 'title' => ts('Note ID'),
123 'description' => ts('Note ID'),
125 'where' => 'civicrm_note.id',
126 'table_name' => 'civicrm_note',
128 'bao' => 'CRM_Core_BAO_Note',
132 'name' => 'entity_table',
133 'type' => CRM_Utils_Type
::T_STRING
,
134 'title' => ts('Note Entity'),
135 'description' => ts('Name of table where item being referenced is stored.'),
138 'size' => CRM_Utils_Type
::BIG
,
139 'where' => 'civicrm_note.entity_table',
140 'table_name' => 'civicrm_note',
142 'bao' => 'CRM_Core_BAO_Note',
144 'pseudoconstant' => [
145 'callback' => 'CRM_Core_BAO_Note::entityTables',
149 'name' => 'entity_id',
150 'type' => CRM_Utils_Type
::T_INT
,
151 'title' => ts('Note Entity ID'),
152 'description' => ts('Foreign key to the referenced item.'),
154 'where' => 'civicrm_note.entity_id',
155 'table_name' => 'civicrm_note',
157 'bao' => 'CRM_Core_BAO_Note',
162 'type' => CRM_Utils_Type
::T_TEXT
,
163 'title' => ts('Note'),
164 'description' => ts('Note and/or Comment.'),
168 'where' => 'civicrm_note.note',
169 'headerPattern' => '/Note|Comment/i',
170 'dataPattern' => '//',
172 'table_name' => 'civicrm_note',
174 'bao' => 'CRM_Core_BAO_Note',
177 'type' => 'TextArea',
181 'name' => 'contact_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Note Created By'),
184 'description' => ts('FK to Contact ID creator'),
185 'where' => 'civicrm_note.contact_id',
186 'table_name' => 'civicrm_note',
188 'bao' => 'CRM_Core_BAO_Note',
190 'FKClassName' => 'CRM_Contact_DAO_Contact',
193 'name' => 'modified_date',
194 'type' => CRM_Utils_Type
::T_DATE
,
195 'title' => ts('Note Modified By'),
196 'description' => ts('When was this note last modified/edited'),
197 'where' => 'civicrm_note.modified_date',
198 'table_name' => 'civicrm_note',
200 'bao' => 'CRM_Core_BAO_Note',
205 'type' => CRM_Utils_Type
::T_STRING
,
206 'title' => ts('Subject'),
207 'description' => ts('subject of note description'),
210 'where' => 'civicrm_note.subject',
211 'table_name' => 'civicrm_note',
213 'bao' => 'CRM_Core_BAO_Note',
221 'type' => CRM_Utils_Type
::T_STRING
,
222 'title' => ts('Privacy'),
223 'description' => ts('Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)'),
225 'size' => CRM_Utils_Type
::HUGE
,
226 'where' => 'civicrm_note.privacy',
227 'table_name' => 'civicrm_note',
229 'bao' => 'CRM_Core_BAO_Note',
234 'pseudoconstant' => [
235 'optionGroupName' => 'note_privacy',
236 'optionEditPath' => 'civicrm/admin/options/note_privacy',
240 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
242 return Civi
::$statics[__CLASS__
]['fields'];
246 * Return a mapping from field-name to the corresponding key (as used in fields()).
249 * Array(string $name => string $uniqueName).
251 public static function &fieldKeys() {
252 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
253 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
255 return Civi
::$statics[__CLASS__
]['fieldKeys'];
259 * Returns the names of this table
263 public static function getTableName() {
264 return self
::$_tableName;
268 * Returns if this table needs to be logged
272 public function getLog() {
277 * Returns the list of fields that can be imported
279 * @param bool $prefix
283 public static function &import($prefix = FALSE) {
284 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'note', $prefix, []);
289 * Returns the list of fields that can be exported
291 * @param bool $prefix
295 public static function &export($prefix = FALSE) {
296 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'note', $prefix, []);
301 * Returns the list of indices
303 * @param bool $localize
307 public static function indices($localize = TRUE) {
310 'name' => 'index_entity',
315 'localizable' => FALSE,
316 'sig' => 'civicrm_note::0::entity_table::entity_id',
319 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;