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:8fe4326f940304ec2c8ea86754d6142e)
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',
135 'name' => 'entity_table',
136 'type' => CRM_Utils_Type
::T_STRING
,
137 'title' => ts('Entity Table'),
138 'description' => ts('Name of table where item being referenced is stored.'),
141 'size' => CRM_Utils_Type
::BIG
,
142 'where' => 'civicrm_log.entity_table',
143 'table_name' => 'civicrm_log',
145 'bao' => 'CRM_Core_BAO_Log',
150 'name' => 'entity_id',
151 'type' => CRM_Utils_Type
::T_INT
,
152 'title' => ts('Entity ID '),
153 'description' => ts('Foreign key to the referenced item.'),
155 'where' => 'civicrm_log.entity_id',
156 'table_name' => 'civicrm_log',
158 'bao' => 'CRM_Core_BAO_Log',
164 'type' => CRM_Utils_Type
::T_TEXT
,
165 'title' => ts('Data'),
166 'description' => ts('Updates does to this object if any.'),
167 'where' => 'civicrm_log.data',
168 'table_name' => 'civicrm_log',
170 'bao' => 'CRM_Core_BAO_Log',
175 'name' => 'modified_id',
176 'type' => CRM_Utils_Type
::T_INT
,
177 'title' => ts('Modified By Contact ID'),
178 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
179 'where' => 'civicrm_log.modified_id',
180 'table_name' => 'civicrm_log',
182 'bao' => 'CRM_Core_BAO_Log',
184 'FKClassName' => 'CRM_Contact_DAO_Contact',
186 'label' => ts("Modified By"),
191 'name' => 'modified_date',
192 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
193 'title' => ts('Modified Date'),
194 'description' => ts('When was the referenced entity created or modified or deleted.'),
195 'where' => 'civicrm_log.modified_date',
196 'table_name' => 'civicrm_log',
198 'bao' => 'CRM_Core_BAO_Log',
203 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
205 return Civi
::$statics[__CLASS__
]['fields'];
209 * Return a mapping from field-name to the corresponding key (as used in fields()).
212 * Array(string $name => string $uniqueName).
214 public static function &fieldKeys() {
215 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
216 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
218 return Civi
::$statics[__CLASS__
]['fieldKeys'];
222 * Returns the names of this table
226 public static function getTableName() {
227 return self
::$_tableName;
231 * Returns if this table needs to be logged
235 public function getLog() {
240 * Returns the list of fields that can be imported
242 * @param bool $prefix
246 public static function &import($prefix = FALSE) {
247 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'log', $prefix, []);
252 * Returns the list of fields that can be exported
254 * @param bool $prefix
258 public static function &export($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'log', $prefix, []);
264 * Returns the list of indices
266 * @param bool $localize
270 public static function indices($localize = TRUE) {
273 'name' => 'index_entity',
278 'localizable' => FALSE,
279 'sig' => 'civicrm_log::0::entity_table::entity_id',
282 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;