Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[civicrm-core.git] / CRM / Core / DAO / Log.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/Log.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b2552b667e074cb7bb4132eac8153df2)
10 */
11
12 /**
13 * Database access object for the Log entity.
14 */
15 class CRM_Core_DAO_Log extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.5';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_log';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Log ID
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Name of table where item being referenced is stored.
44 *
45 * @var string
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $entity_table;
50
51 /**
52 * Foreign key to the referenced item.
53 *
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $entity_id;
59
60 /**
61 * Updates does to this object if any.
62 *
63 * @var string|null
64 * (SQL type: text)
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $data;
68
69 /**
70 * FK to Contact ID of person under whose credentials this data modification was made.
71 *
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
75 */
76 public $modified_id;
77
78 /**
79 * When was the referenced entity created or modified or deleted.
80 *
81 * @var string|null
82 * (SQL type: datetime)
83 * Note that values will be retrieved from the database as a string.
84 */
85 public $modified_date;
86
87 /**
88 * Class constructor.
89 */
90 public function __construct() {
91 $this->__table = 'civicrm_log';
92 parent::__construct();
93 }
94
95 /**
96 * Returns localized title of this entity.
97 *
98 * @param bool $plural
99 * Whether to return the plural version of the title.
100 */
101 public static function getEntityTitle($plural = FALSE) {
102 return $plural ? ts('Logs') : ts('Log');
103 }
104
105 /**
106 * Returns foreign keys and entity references.
107 *
108 * @return array
109 * [CRM_Core_Reference_Interface]
110 */
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']);
117 }
118 return Civi::$statics[__CLASS__]['links'];
119 }
120
121 /**
122 * Returns all the column names of this table
123 *
124 * @return array
125 */
126 public static function &fields() {
127 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
128 Civi::$statics[__CLASS__]['fields'] = [
129 'id' => [
130 'name' => 'id',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('Log ID'),
133 'description' => ts('Log ID'),
134 'required' => TRUE,
135 'where' => 'civicrm_log.id',
136 'table_name' => 'civicrm_log',
137 'entity' => 'Log',
138 'bao' => 'CRM_Core_BAO_Log',
139 'localizable' => 0,
140 'html' => [
141 'type' => 'Number',
142 ],
143 'readonly' => TRUE,
144 'add' => '1.5',
145 ],
146 'entity_table' => [
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.'),
151 'required' => TRUE,
152 'maxlength' => 64,
153 'size' => CRM_Utils_Type::BIG,
154 'where' => 'civicrm_log.entity_table',
155 'table_name' => 'civicrm_log',
156 'entity' => 'Log',
157 'bao' => 'CRM_Core_BAO_Log',
158 'localizable' => 0,
159 'add' => '1.5',
160 ],
161 'entity_id' => [
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.'),
166 'required' => TRUE,
167 'where' => 'civicrm_log.entity_id',
168 'table_name' => 'civicrm_log',
169 'entity' => 'Log',
170 'bao' => 'CRM_Core_BAO_Log',
171 'localizable' => 0,
172 'add' => '1.5',
173 ],
174 'data' => [
175 'name' => 'data',
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',
181 'entity' => 'Log',
182 'bao' => 'CRM_Core_BAO_Log',
183 'localizable' => 0,
184 'add' => '1.5',
185 ],
186 'modified_id' => [
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',
193 'entity' => 'Log',
194 'bao' => 'CRM_Core_BAO_Log',
195 'localizable' => 0,
196 'FKClassName' => 'CRM_Contact_DAO_Contact',
197 'html' => [
198 'label' => ts("Modified By"),
199 ],
200 'add' => '1.5',
201 ],
202 'modified_date' => [
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',
209 'entity' => 'Log',
210 'bao' => 'CRM_Core_BAO_Log',
211 'localizable' => 0,
212 'add' => '1.5',
213 ],
214 ];
215 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
216 }
217 return Civi::$statics[__CLASS__]['fields'];
218 }
219
220 /**
221 * Return a mapping from field-name to the corresponding key (as used in fields()).
222 *
223 * @return array
224 * Array(string $name => string $uniqueName).
225 */
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()));
229 }
230 return Civi::$statics[__CLASS__]['fieldKeys'];
231 }
232
233 /**
234 * Returns the names of this table
235 *
236 * @return string
237 */
238 public static function getTableName() {
239 return self::$_tableName;
240 }
241
242 /**
243 * Returns if this table needs to be logged
244 *
245 * @return bool
246 */
247 public function getLog() {
248 return self::$_log;
249 }
250
251 /**
252 * Returns the list of fields that can be imported
253 *
254 * @param bool $prefix
255 *
256 * @return array
257 */
258 public static function &import($prefix = FALSE) {
259 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, []);
260 return $r;
261 }
262
263 /**
264 * Returns the list of fields that can be exported
265 *
266 * @param bool $prefix
267 *
268 * @return array
269 */
270 public static function &export($prefix = FALSE) {
271 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, []);
272 return $r;
273 }
274
275 /**
276 * Returns the list of indices
277 *
278 * @param bool $localize
279 *
280 * @return array
281 */
282 public static function indices($localize = TRUE) {
283 $indices = [
284 'index_entity' => [
285 'name' => 'index_entity',
286 'field' => [
287 0 => 'entity_table',
288 1 => 'entity_id',
289 ],
290 'localizable' => FALSE,
291 'sig' => 'civicrm_log::0::entity_table::entity_id',
292 ],
293 ];
294 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
295 }
296
297 }