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