Declare API Key as a protected field for future use
[civicrm-core.git] / CRM / Core / DAO / Log.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Log.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
042043f1 9 * (GenCodeChecksum:8f9b854de72d9db99a03353832bbffc1)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Log entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Log extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_log';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Log ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Name of table where item being referenced is stored.
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign key to the referenced item.
47 *
48 * @var int unsigned
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * Updates does to this object if any.
54 *
55 * @var text
56 */
57 public $data;
c3fc2621 58
e501603b
TO
59 /**
60 * FK to Contact ID of person under whose credentials this data modification was made.
61 *
62 * @var int unsigned
63 */
64 public $modified_id;
c3fc2621 65
e501603b
TO
66 /**
67 * When was the referenced entity created or modified or deleted.
68 *
69 * @var datetime
70 */
71 public $modified_date;
c3fc2621 72
e501603b 73 /**
f41f0342 74 * Class constructor.
e501603b 75 */
c3fc2621 76 public function __construct() {
e501603b
TO
77 $this->__table = 'civicrm_log';
78 parent::__construct();
79 }
c3fc2621 80
e501603b 81 /**
f41f0342 82 * Returns foreign keys and entity references.
e501603b
TO
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
c3fc2621 87 public static function getReferenceColumns() {
346aaaba 88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 89 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'modified_id', 'civicrm_contact', 'id');
91 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 92 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 93 }
346aaaba 94 return Civi::$statics[__CLASS__]['links'];
e501603b 95 }
c3fc2621 96
e501603b
TO
97 /**
98 * Returns all the column names of this table
99 *
100 * @return array
101 */
c3fc2621 102 public static function &fields() {
346aaaba 103 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
104 Civi::$statics[__CLASS__]['fields'] = [
105 'id' => [
e501603b
TO
106 'name' => 'id',
107 'type' => CRM_Utils_Type::T_INT,
c3fc2621 108 'title' => ts('Log ID'),
215b423e 109 'description' => ts('Log ID'),
c3fc2621 110 'required' => TRUE,
a36434b9 111 'where' => 'civicrm_log.id',
522a26c9 112 'table_name' => 'civicrm_log',
113 'entity' => 'Log',
114 'bao' => 'CRM_Core_BAO_Log',
6a7e5e5d 115 'localizable' => 0,
c3fc2621
CW
116 ],
117 'entity_table' => [
e501603b
TO
118 'name' => 'entity_table',
119 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 120 'title' => ts('Entity Table'),
215b423e 121 'description' => ts('Name of table where item being referenced is stored.'),
c3fc2621 122 'required' => TRUE,
e501603b
TO
123 'maxlength' => 64,
124 'size' => CRM_Utils_Type::BIG,
a36434b9 125 'where' => 'civicrm_log.entity_table',
522a26c9 126 'table_name' => 'civicrm_log',
127 'entity' => 'Log',
128 'bao' => 'CRM_Core_BAO_Log',
6a7e5e5d 129 'localizable' => 0,
c3fc2621
CW
130 ],
131 'entity_id' => [
e501603b
TO
132 'name' => 'entity_id',
133 'type' => CRM_Utils_Type::T_INT,
c3fc2621 134 'title' => ts('Entity ID '),
215b423e 135 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 136 'required' => TRUE,
a36434b9 137 'where' => 'civicrm_log.entity_id',
522a26c9 138 'table_name' => 'civicrm_log',
139 'entity' => 'Log',
140 'bao' => 'CRM_Core_BAO_Log',
6a7e5e5d 141 'localizable' => 0,
c3fc2621
CW
142 ],
143 'data' => [
e501603b
TO
144 'name' => 'data',
145 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 146 'title' => ts('Data'),
215b423e 147 'description' => ts('Updates does to this object if any.'),
a36434b9 148 'where' => 'civicrm_log.data',
522a26c9 149 'table_name' => 'civicrm_log',
150 'entity' => 'Log',
151 'bao' => 'CRM_Core_BAO_Log',
6a7e5e5d 152 'localizable' => 0,
c3fc2621
CW
153 ],
154 'modified_id' => [
e501603b
TO
155 'name' => 'modified_id',
156 'type' => CRM_Utils_Type::T_INT,
c3fc2621 157 'title' => ts('Modified By'),
215b423e 158 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
a36434b9 159 'where' => 'civicrm_log.modified_id',
522a26c9 160 'table_name' => 'civicrm_log',
161 'entity' => 'Log',
162 'bao' => 'CRM_Core_BAO_Log',
6a7e5e5d 163 'localizable' => 0,
e501603b 164 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
165 ],
166 'modified_date' => [
e501603b
TO
167 'name' => 'modified_date',
168 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
c3fc2621 169 'title' => ts('Modified Date'),
215b423e 170 'description' => ts('When was the referenced entity created or modified or deleted.'),
a36434b9 171 'where' => 'civicrm_log.modified_date',
522a26c9 172 'table_name' => 'civicrm_log',
173 'entity' => 'Log',
174 'bao' => 'CRM_Core_BAO_Log',
6a7e5e5d 175 'localizable' => 0,
c3fc2621
CW
176 ],
177 ];
346aaaba 178 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 179 }
346aaaba 180 return Civi::$statics[__CLASS__]['fields'];
e501603b 181 }
c3fc2621 182
e501603b 183 /**
bd8e0b14 184 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
185 *
186 * @return array
bd8e0b14 187 * Array(string $name => string $uniqueName).
e501603b 188 */
c3fc2621 189 public static function &fieldKeys() {
bd8e0b14
TO
190 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
191 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 192 }
bd8e0b14 193 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 194 }
c3fc2621 195
e501603b
TO
196 /**
197 * Returns the names of this table
198 *
199 * @return string
200 */
c3fc2621 201 public static function getTableName() {
e501603b
TO
202 return self::$_tableName;
203 }
c3fc2621 204
e501603b
TO
205 /**
206 * Returns if this table needs to be logged
207 *
c3fc2621 208 * @return bool
e501603b 209 */
c3fc2621 210 public function getLog() {
e501603b
TO
211 return self::$_log;
212 }
c3fc2621 213
e501603b
TO
214 /**
215 * Returns the list of fields that can be imported
216 *
217 * @param bool $prefix
218 *
219 * @return array
220 */
c3fc2621
CW
221 public static function &import($prefix = FALSE) {
222 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, []);
60808919 223 return $r;
e501603b 224 }
c3fc2621 225
e501603b
TO
226 /**
227 * Returns the list of fields that can be exported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
c3fc2621
CW
233 public static function &export($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, []);
60808919 235 return $r;
e501603b 236 }
c3fc2621 237
e7a6b91a
AS
238 /**
239 * Returns the list of indices
c3fc2621
CW
240 *
241 * @param bool $localize
242 *
243 * @return array
e7a6b91a
AS
244 */
245 public static function indices($localize = TRUE) {
c3fc2621
CW
246 $indices = [
247 'index_entity' => [
e7a6b91a 248 'name' => 'index_entity',
c3fc2621 249 'field' => [
e7a6b91a
AS
250 0 => 'entity_table',
251 1 => 'entity_id',
c3fc2621
CW
252 ],
253 'localizable' => FALSE,
e7a6b91a 254 'sig' => 'civicrm_log::0::entity_table::entity_id',
c3fc2621
CW
255 ],
256 ];
e7a6b91a
AS
257 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
258 }
c3fc2621 259
e501603b 260}