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:b2552b667e074cb7bb4132eac8153df2)
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;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Name of table where item being referenced is stored.
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
52 * Foreign key to the referenced item.
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
61 * Updates does to this object if any.
65 * Note that values will be retrieved from the database as a string.
70 * FK to Contact ID of person under whose credentials this data modification was made.
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
79 * When was the referenced entity created or modified or deleted.
82 * (SQL type: datetime)
83 * Note that values will be retrieved from the database as a string.
85 public $modified_date;
90 public function __construct() {
91 $this->__table
= 'civicrm_log';
92 parent
::__construct();
96 * Returns localized title of this entity.
99 * Whether to return the plural version of the title.
101 public static function getEntityTitle($plural = FALSE) {
102 return $plural ?
ts('Logs') : ts('Log');
106 * Returns foreign keys and entity references.
109 * [CRM_Core_Reference_Interface]
111 public static function getReferenceColumns() {
112 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
113 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
114 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'modified_id', 'civicrm_contact', 'id');
115 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
116 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
118 return Civi
::$statics[__CLASS__
]['links'];
122 * Returns all the column names of this table
126 public static function &fields() {
127 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
128 Civi
::$statics[__CLASS__
]['fields'] = [
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Log ID'),
133 'description' => ts('Log ID'),
135 'where' => 'civicrm_log.id',
136 'table_name' => 'civicrm_log',
138 'bao' => 'CRM_Core_BAO_Log',
147 'name' => 'entity_table',
148 'type' => CRM_Utils_Type
::T_STRING
,
149 'title' => ts('Entity Table'),
150 'description' => ts('Name of table where item being referenced is stored.'),
153 'size' => CRM_Utils_Type
::BIG
,
154 'where' => 'civicrm_log.entity_table',
155 'table_name' => 'civicrm_log',
157 'bao' => 'CRM_Core_BAO_Log',
162 'name' => 'entity_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Entity ID '),
165 'description' => ts('Foreign key to the referenced item.'),
167 'where' => 'civicrm_log.entity_id',
168 'table_name' => 'civicrm_log',
170 'bao' => 'CRM_Core_BAO_Log',
176 'type' => CRM_Utils_Type
::T_TEXT
,
177 'title' => ts('Data'),
178 'description' => ts('Updates does to this object if any.'),
179 'where' => 'civicrm_log.data',
180 'table_name' => 'civicrm_log',
182 'bao' => 'CRM_Core_BAO_Log',
187 'name' => 'modified_id',
188 'type' => CRM_Utils_Type
::T_INT
,
189 'title' => ts('Modified By Contact ID'),
190 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
191 'where' => 'civicrm_log.modified_id',
192 'table_name' => 'civicrm_log',
194 'bao' => 'CRM_Core_BAO_Log',
196 'FKClassName' => 'CRM_Contact_DAO_Contact',
198 'label' => ts("Modified By"),
203 'name' => 'modified_date',
204 'type' => CRM_Utils_Type
::T_DATE + CRM_Utils_Type
::T_TIME
,
205 'title' => ts('Modified Date'),
206 'description' => ts('When was the referenced entity created or modified or deleted.'),
207 'where' => 'civicrm_log.modified_date',
208 'table_name' => 'civicrm_log',
210 'bao' => 'CRM_Core_BAO_Log',
215 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
217 return Civi
::$statics[__CLASS__
]['fields'];
221 * Return a mapping from field-name to the corresponding key (as used in fields()).
224 * Array(string $name => string $uniqueName).
226 public static function &fieldKeys() {
227 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
228 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
230 return Civi
::$statics[__CLASS__
]['fieldKeys'];
234 * Returns the names of this table
238 public static function getTableName() {
239 return self
::$_tableName;
243 * Returns if this table needs to be logged
247 public function getLog() {
252 * Returns the list of fields that can be imported
254 * @param bool $prefix
258 public static function &import($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'log', $prefix, []);
264 * Returns the list of fields that can be exported
266 * @param bool $prefix
270 public static function &export($prefix = FALSE) {
271 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'log', $prefix, []);
276 * Returns the list of indices
278 * @param bool $localize
282 public static function indices($localize = TRUE) {
285 'name' => 'index_entity',
290 'localizable' => FALSE,
291 'sig' => 'civicrm_log::0::entity_table::entity_id',
294 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;