Merge pull request #19205 from eileenmcnaughton/mem_forms
[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:816b07245cf23f330f371b32bc278d17)
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
37 */
38 public $id;
39
40 /**
41 * Name of table where item being referenced is stored.
42 *
43 * @var string
44 */
45 public $entity_table;
46
47 /**
48 * Foreign key to the referenced item.
49 *
50 * @var int
51 */
52 public $entity_id;
53
54 /**
55 * Updates does to this object if any.
56 *
57 * @var text
58 */
59 public $data;
60
61 /**
62 * FK to Contact ID of person under whose credentials this data modification was made.
63 *
64 * @var int
65 */
66 public $modified_id;
67
68 /**
69 * When was the referenced entity created or modified or deleted.
70 *
71 * @var datetime
72 */
73 public $modified_date;
74
75 /**
76 * Class constructor.
77 */
78 public function __construct() {
79 $this->__table = 'civicrm_log';
80 parent::__construct();
81 }
82
83 /**
84 * Returns localized title of this entity.
85 *
86 * @param bool $plural
87 * Whether to return the plural version of the title.
88 */
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ? ts('Logs') : ts('Log');
91 }
92
93 /**
94 * Returns foreign keys and entity references.
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
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']);
105 }
106 return Civi::$statics[__CLASS__]['links'];
107 }
108
109 /**
110 * Returns all the column names of this table
111 *
112 * @return array
113 */
114 public static function &fields() {
115 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
116 Civi::$statics[__CLASS__]['fields'] = [
117 'id' => [
118 'name' => 'id',
119 'type' => CRM_Utils_Type::T_INT,
120 'title' => ts('Log ID'),
121 'description' => ts('Log ID'),
122 'required' => TRUE,
123 'where' => 'civicrm_log.id',
124 'table_name' => 'civicrm_log',
125 'entity' => 'Log',
126 'bao' => 'CRM_Core_BAO_Log',
127 'localizable' => 0,
128 'add' => '1.5',
129 ],
130 'entity_table' => [
131 'name' => 'entity_table',
132 'type' => CRM_Utils_Type::T_STRING,
133 'title' => ts('Entity Table'),
134 'description' => ts('Name of table where item being referenced is stored.'),
135 'required' => TRUE,
136 'maxlength' => 64,
137 'size' => CRM_Utils_Type::BIG,
138 'where' => 'civicrm_log.entity_table',
139 'table_name' => 'civicrm_log',
140 'entity' => 'Log',
141 'bao' => 'CRM_Core_BAO_Log',
142 'localizable' => 0,
143 'add' => '1.5',
144 ],
145 'entity_id' => [
146 'name' => 'entity_id',
147 'type' => CRM_Utils_Type::T_INT,
148 'title' => ts('Entity ID '),
149 'description' => ts('Foreign key to the referenced item.'),
150 'required' => TRUE,
151 'where' => 'civicrm_log.entity_id',
152 'table_name' => 'civicrm_log',
153 'entity' => 'Log',
154 'bao' => 'CRM_Core_BAO_Log',
155 'localizable' => 0,
156 'add' => '1.5',
157 ],
158 'data' => [
159 'name' => 'data',
160 'type' => CRM_Utils_Type::T_TEXT,
161 'title' => ts('Data'),
162 'description' => ts('Updates does to this object if any.'),
163 'where' => 'civicrm_log.data',
164 'table_name' => 'civicrm_log',
165 'entity' => 'Log',
166 'bao' => 'CRM_Core_BAO_Log',
167 'localizable' => 0,
168 'add' => '1.5',
169 ],
170 'modified_id' => [
171 'name' => 'modified_id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Modified By'),
174 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'),
175 'where' => 'civicrm_log.modified_id',
176 'table_name' => 'civicrm_log',
177 'entity' => 'Log',
178 'bao' => 'CRM_Core_BAO_Log',
179 'localizable' => 0,
180 'FKClassName' => 'CRM_Contact_DAO_Contact',
181 'add' => '1.5',
182 ],
183 'modified_date' => [
184 'name' => 'modified_date',
185 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
186 'title' => ts('Modified Date'),
187 'description' => ts('When was the referenced entity created or modified or deleted.'),
188 'where' => 'civicrm_log.modified_date',
189 'table_name' => 'civicrm_log',
190 'entity' => 'Log',
191 'bao' => 'CRM_Core_BAO_Log',
192 'localizable' => 0,
193 'add' => '1.5',
194 ],
195 ];
196 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
197 }
198 return Civi::$statics[__CLASS__]['fields'];
199 }
200
201 /**
202 * Return a mapping from field-name to the corresponding key (as used in fields()).
203 *
204 * @return array
205 * Array(string $name => string $uniqueName).
206 */
207 public static function &fieldKeys() {
208 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
209 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
210 }
211 return Civi::$statics[__CLASS__]['fieldKeys'];
212 }
213
214 /**
215 * Returns the names of this table
216 *
217 * @return string
218 */
219 public static function getTableName() {
220 return self::$_tableName;
221 }
222
223 /**
224 * Returns if this table needs to be logged
225 *
226 * @return bool
227 */
228 public function getLog() {
229 return self::$_log;
230 }
231
232 /**
233 * Returns the list of fields that can be imported
234 *
235 * @param bool $prefix
236 *
237 * @return array
238 */
239 public static function &import($prefix = FALSE) {
240 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, []);
241 return $r;
242 }
243
244 /**
245 * Returns the list of fields that can be exported
246 *
247 * @param bool $prefix
248 *
249 * @return array
250 */
251 public static function &export($prefix = FALSE) {
252 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, []);
253 return $r;
254 }
255
256 /**
257 * Returns the list of indices
258 *
259 * @param bool $localize
260 *
261 * @return array
262 */
263 public static function indices($localize = TRUE) {
264 $indices = [
265 'index_entity' => [
266 'name' => 'index_entity',
267 'field' => [
268 0 => 'entity_table',
269 1 => 'entity_id',
270 ],
271 'localizable' => FALSE,
272 'sig' => 'civicrm_log::0::entity_table::entity_id',
273 ],
274 ];
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
276 }
277
278 }