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:3f7c58e17bdae8212004611d6fa2f6f3)
13 * Database access object for the Log entity.
15 class CRM_Core_DAO_Log
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_log';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Name of table where item being referenced is stored.
46 * Foreign key to the referenced item.
53 * Updates does to this object if any.
60 * FK to Contact ID of person under whose credentials this data modification was made.
67 * When was the referenced entity created or modified or deleted.
71 public $modified_date;
76 public function __construct() {
77 $this->__table
= 'civicrm_log';
78 parent
::__construct();
82 * Returns localized title of this entity.
84 public static function getEntityTitle() {
89 * Returns foreign keys and entity references.
92 * [CRM_Core_Reference_Interface]
94 public static function getReferenceColumns() {
95 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
96 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
98 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
99 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
101 return Civi
::$statics[__CLASS__
]['links'];
105 * Returns all the column names of this table
109 public static function &fields() {
110 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
111 Civi
::$statics[__CLASS__
]['fields'] = [
114 'type' => CRM_Utils_Type
::T_INT
,
115 'title' => ts('Log ID'),
116 'description' => ts('Log ID'),
118 'where' => 'civicrm_log.id',
119 'table_name' => 'civicrm_log',
121 'bao' => 'CRM_Core_BAO_Log',
125 'name' => 'entity_table',
126 'type' => CRM_Utils_Type
::T_STRING
,
127 'title' => ts('Entity Table'),
128 'description' => ts('Name of table where item being referenced is stored.'),
131 'size' => CRM_Utils_Type
::BIG
,
132 'where' => 'civicrm_log.entity_table',
133 'table_name' => 'civicrm_log',
135 'bao' => 'CRM_Core_BAO_Log',
139 'name' => 'entity_id',
140 'type' => CRM_Utils_Type
::T_INT
,
141 'title' => ts('Entity ID '),
142 'description' => ts('Foreign key to the referenced item.'),
144 'where' => 'civicrm_log.entity_id',
145 'table_name' => 'civicrm_log',
147 'bao' => 'CRM_Core_BAO_Log',
152 'type' => CRM_Utils_Type
::T_TEXT
,
153 'title' => ts('Data'),
154 'description' => ts('Updates does to this object if any.'),
155 'where' => 'civicrm_log.data',
156 'table_name' => 'civicrm_log',
158 'bao' => 'CRM_Core_BAO_Log',
162 'name' => 'modified_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Modified By'),
165 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
166 'where' => 'civicrm_log.modified_id',
167 'table_name' => 'civicrm_log',
169 'bao' => 'CRM_Core_BAO_Log',
171 'FKClassName' => 'CRM_Contact_DAO_Contact',
174 'name' => 'modified_date',
175 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
176 'title' => ts('Modified Date'),
177 'description' => ts('When was the referenced entity created or modified or deleted.'),
178 'where' => 'civicrm_log.modified_date',
179 'table_name' => 'civicrm_log',
181 'bao' => 'CRM_Core_BAO_Log',
185 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
187 return Civi
::$statics[__CLASS__
]['fields'];
191 * Return a mapping from field-name to the corresponding key (as used in fields()).
194 * Array(string $name => string $uniqueName).
196 public static function &fieldKeys() {
197 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
198 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
200 return Civi
::$statics[__CLASS__
]['fieldKeys'];
204 * Returns the names of this table
208 public static function getTableName() {
209 return self
::$_tableName;
213 * Returns if this table needs to be logged
217 public function getLog() {
222 * Returns the list of fields that can be imported
224 * @param bool $prefix
228 public static function &import($prefix = FALSE) {
229 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'log', $prefix, []);
234 * Returns the list of fields that can be exported
236 * @param bool $prefix
240 public static function &export($prefix = FALSE) {
241 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'log', $prefix, []);
246 * Returns the list of indices
248 * @param bool $localize
252 public static function indices($localize = TRUE) {
255 'name' => 'index_entity',
260 'localizable' => FALSE,
261 'sig' => 'civicrm_log::0::entity_table::entity_id',
264 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;