5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Log.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:816b07245cf23f330f371b32bc278d17)
13 * Database access object for the Log entity.
15 class CRM_Core_DAO_Log
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_log';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Name of table where item being referenced is stored.
48 * Foreign key to the referenced item.
55 * Updates does to this object if any.
62 * FK to Contact ID of person under whose credentials this data modification was made.
69 * When was the referenced entity created or modified or deleted.
73 public $modified_date;
78 public function __construct() {
79 $this->__table
= 'civicrm_log';
80 parent
::__construct();
84 * Returns localized title of this entity.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Logs') : ts('Log');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
103 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
104 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
106 return Civi
::$statics[__CLASS__
]['links'];
110 * Returns all the column names of this table
114 public static function &fields() {
115 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
116 Civi
::$statics[__CLASS__
]['fields'] = [
119 'type' => CRM_Utils_Type
::T_INT
,
120 'title' => ts('Log ID'),
121 'description' => ts('Log ID'),
123 'where' => 'civicrm_log.id',
124 'table_name' => 'civicrm_log',
126 'bao' => 'CRM_Core_BAO_Log',
131 'name' => 'entity_table',
132 'type' => CRM_Utils_Type
::T_STRING
,
133 'title' => ts('Entity Table'),
134 'description' => ts('Name of table where item being referenced is stored.'),
137 'size' => CRM_Utils_Type
::BIG
,
138 'where' => 'civicrm_log.entity_table',
139 'table_name' => 'civicrm_log',
141 'bao' => 'CRM_Core_BAO_Log',
146 'name' => 'entity_id',
147 'type' => CRM_Utils_Type
::T_INT
,
148 'title' => ts('Entity ID '),
149 'description' => ts('Foreign key to the referenced item.'),
151 'where' => 'civicrm_log.entity_id',
152 'table_name' => 'civicrm_log',
154 'bao' => 'CRM_Core_BAO_Log',
160 'type' => CRM_Utils_Type
::T_TEXT
,
161 'title' => ts('Data'),
162 'description' => ts('Updates does to this object if any.'),
163 'where' => 'civicrm_log.data',
164 'table_name' => 'civicrm_log',
166 'bao' => 'CRM_Core_BAO_Log',
171 'name' => 'modified_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Modified By'),
174 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
175 'where' => 'civicrm_log.modified_id',
176 'table_name' => 'civicrm_log',
178 'bao' => 'CRM_Core_BAO_Log',
180 'FKClassName' => 'CRM_Contact_DAO_Contact',
184 'name' => 'modified_date',
185 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
186 'title' => ts('Modified Date'),
187 'description' => ts('When was the referenced entity created or modified or deleted.'),
188 'where' => 'civicrm_log.modified_date',
189 'table_name' => 'civicrm_log',
191 'bao' => 'CRM_Core_BAO_Log',
196 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
198 return Civi
::$statics[__CLASS__
]['fields'];
202 * Return a mapping from field-name to the corresponding key (as used in fields()).
205 * Array(string $name => string $uniqueName).
207 public static function &fieldKeys() {
208 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
209 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
211 return Civi
::$statics[__CLASS__
]['fieldKeys'];
215 * Returns the names of this table
219 public static function getTableName() {
220 return self
::$_tableName;
224 * Returns if this table needs to be logged
228 public function getLog() {
233 * Returns the list of fields that can be imported
235 * @param bool $prefix
239 public static function &import($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'log', $prefix, []);
245 * Returns the list of fields that can be exported
247 * @param bool $prefix
251 public static function &export($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'log', $prefix, []);
257 * Returns the list of indices
259 * @param bool $localize
263 public static function indices($localize = TRUE) {
266 'name' => 'index_entity',
271 'localizable' => FALSE,
272 'sig' => 'civicrm_log::0::entity_table::entity_id',
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;