Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
8c9251b3 | 5 | * @copyright CiviCRM LLC (c) 2004-2018 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/Core/Log.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e380ee3b | 9 | * (GenCodeChecksum:38303a678c8e5104d63803ce900dc370) |
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 { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
22 | 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 | */ |
c3fc2621 CW |
29 | static $_log = FALSE; |
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 TO |
88 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
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, |
522a26c9 | 111 | 'table_name' => 'civicrm_log', |
112 | 'entity' => 'Log', | |
113 | 'bao' => 'CRM_Core_BAO_Log', | |
6a7e5e5d | 114 | 'localizable' => 0, |
c3fc2621 CW |
115 | ], |
116 | 'entity_table' => [ | |
e501603b TO |
117 | 'name' => 'entity_table', |
118 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 119 | 'title' => ts('Entity Table'), |
215b423e | 120 | 'description' => ts('Name of table where item being referenced is stored.'), |
c3fc2621 | 121 | 'required' => TRUE, |
e501603b TO |
122 | 'maxlength' => 64, |
123 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 124 | 'table_name' => 'civicrm_log', |
125 | 'entity' => 'Log', | |
126 | 'bao' => 'CRM_Core_BAO_Log', | |
6a7e5e5d | 127 | 'localizable' => 0, |
c3fc2621 CW |
128 | ], |
129 | 'entity_id' => [ | |
e501603b TO |
130 | 'name' => 'entity_id', |
131 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 132 | 'title' => ts('Entity ID '), |
215b423e | 133 | 'description' => ts('Foreign key to the referenced item.'), |
c3fc2621 | 134 | 'required' => TRUE, |
522a26c9 | 135 | 'table_name' => 'civicrm_log', |
136 | 'entity' => 'Log', | |
137 | 'bao' => 'CRM_Core_BAO_Log', | |
6a7e5e5d | 138 | 'localizable' => 0, |
c3fc2621 CW |
139 | ], |
140 | 'data' => [ | |
e501603b TO |
141 | 'name' => 'data', |
142 | 'type' => CRM_Utils_Type::T_TEXT, | |
c3fc2621 | 143 | 'title' => ts('Data'), |
215b423e | 144 | 'description' => ts('Updates does to this object if any.'), |
522a26c9 | 145 | 'table_name' => 'civicrm_log', |
146 | 'entity' => 'Log', | |
147 | 'bao' => 'CRM_Core_BAO_Log', | |
6a7e5e5d | 148 | 'localizable' => 0, |
c3fc2621 CW |
149 | ], |
150 | 'modified_id' => [ | |
e501603b TO |
151 | 'name' => 'modified_id', |
152 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 153 | 'title' => ts('Modified By'), |
215b423e | 154 | 'description' => ts('FK to Contact ID of person under whose credentials this data modification was made.'), |
522a26c9 | 155 | 'table_name' => 'civicrm_log', |
156 | 'entity' => 'Log', | |
157 | 'bao' => 'CRM_Core_BAO_Log', | |
6a7e5e5d | 158 | 'localizable' => 0, |
e501603b | 159 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
160 | ], |
161 | 'modified_date' => [ | |
e501603b TO |
162 | 'name' => 'modified_date', |
163 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
c3fc2621 | 164 | 'title' => ts('Modified Date'), |
215b423e | 165 | 'description' => ts('When was the referenced entity created or modified or deleted.'), |
522a26c9 | 166 | 'table_name' => 'civicrm_log', |
167 | 'entity' => 'Log', | |
168 | 'bao' => 'CRM_Core_BAO_Log', | |
6a7e5e5d | 169 | 'localizable' => 0, |
c3fc2621 CW |
170 | ], |
171 | ]; | |
346aaaba | 172 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 173 | } |
346aaaba | 174 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 175 | } |
c3fc2621 | 176 | |
e501603b | 177 | /** |
bd8e0b14 | 178 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
179 | * |
180 | * @return array | |
bd8e0b14 | 181 | * Array(string $name => string $uniqueName). |
e501603b | 182 | */ |
c3fc2621 | 183 | public static function &fieldKeys() { |
bd8e0b14 TO |
184 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
185 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 186 | } |
bd8e0b14 | 187 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 188 | } |
c3fc2621 | 189 | |
e501603b TO |
190 | /** |
191 | * Returns the names of this table | |
192 | * | |
193 | * @return string | |
194 | */ | |
c3fc2621 | 195 | public static function getTableName() { |
e501603b TO |
196 | return self::$_tableName; |
197 | } | |
c3fc2621 | 198 | |
e501603b TO |
199 | /** |
200 | * Returns if this table needs to be logged | |
201 | * | |
c3fc2621 | 202 | * @return bool |
e501603b | 203 | */ |
c3fc2621 | 204 | public function getLog() { |
e501603b TO |
205 | return self::$_log; |
206 | } | |
c3fc2621 | 207 | |
e501603b TO |
208 | /** |
209 | * Returns the list of fields that can be imported | |
210 | * | |
211 | * @param bool $prefix | |
212 | * | |
213 | * @return array | |
214 | */ | |
c3fc2621 CW |
215 | public static function &import($prefix = FALSE) { |
216 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, []); | |
60808919 | 217 | return $r; |
e501603b | 218 | } |
c3fc2621 | 219 | |
e501603b TO |
220 | /** |
221 | * Returns the list of fields that can be exported | |
222 | * | |
223 | * @param bool $prefix | |
224 | * | |
225 | * @return array | |
226 | */ | |
c3fc2621 CW |
227 | public static function &export($prefix = FALSE) { |
228 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, []); | |
60808919 | 229 | return $r; |
e501603b | 230 | } |
c3fc2621 | 231 | |
e7a6b91a AS |
232 | /** |
233 | * Returns the list of indices | |
c3fc2621 CW |
234 | * |
235 | * @param bool $localize | |
236 | * | |
237 | * @return array | |
e7a6b91a AS |
238 | */ |
239 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
240 | $indices = [ |
241 | 'index_entity' => [ | |
e7a6b91a | 242 | 'name' => 'index_entity', |
c3fc2621 | 243 | 'field' => [ |
e7a6b91a AS |
244 | 0 => 'entity_table', |
245 | 1 => 'entity_id', | |
c3fc2621 CW |
246 | ], |
247 | 'localizable' => FALSE, | |
e7a6b91a | 248 | 'sig' => 'civicrm_log::0::entity_table::entity_id', |
c3fc2621 CW |
249 | ], |
250 | ]; | |
e7a6b91a AS |
251 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
252 | } | |
c3fc2621 | 253 | |
e501603b | 254 | } |