Commit | Line | Data |
---|---|---|
e501603b TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM version 4.7 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright CiviCRM LLC (c) 2004-2016 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | /** | |
28 | * @package CRM | |
29 | * @copyright CiviCRM LLC (c) 2004-2016 | |
30 | * | |
31 | * Generated from xml/schema/CRM/Core/Log.xml | |
32 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
437fafcf | 33 | * (GenCodeChecksum:316a8a9a9d716cc5847f05668de2c331) |
e501603b TO |
34 | */ |
35 | require_once 'CRM/Core/DAO.php'; | |
36 | require_once 'CRM/Utils/Type.php'; | |
37 | class CRM_Core_DAO_Log extends CRM_Core_DAO { | |
38 | /** | |
39 | * static instance to hold the table name | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | static $_tableName = 'civicrm_log'; | |
e501603b TO |
44 | /** |
45 | * static value to see if we should log any modifications to | |
46 | * this table in the civicrm_log table | |
47 | * | |
48 | * @var boolean | |
49 | */ | |
50 | static $_log = false; | |
51 | /** | |
52 | * Log ID | |
53 | * | |
54 | * @var int unsigned | |
55 | */ | |
56 | public $id; | |
57 | /** | |
58 | * Name of table where item being referenced is stored. | |
59 | * | |
60 | * @var string | |
61 | */ | |
62 | public $entity_table; | |
63 | /** | |
64 | * Foreign key to the referenced item. | |
65 | * | |
66 | * @var int unsigned | |
67 | */ | |
68 | public $entity_id; | |
69 | /** | |
70 | * Updates does to this object if any. | |
71 | * | |
72 | * @var text | |
73 | */ | |
74 | public $data; | |
75 | /** | |
76 | * FK to Contact ID of person under whose credentials this data modification was made. | |
77 | * | |
78 | * @var int unsigned | |
79 | */ | |
80 | public $modified_id; | |
81 | /** | |
82 | * When was the referenced entity created or modified or deleted. | |
83 | * | |
84 | * @var datetime | |
85 | */ | |
86 | public $modified_date; | |
87 | /** | |
88 | * class constructor | |
89 | * | |
90 | * @return civicrm_log | |
91 | */ | |
92 | function __construct() { | |
93 | $this->__table = 'civicrm_log'; | |
94 | parent::__construct(); | |
95 | } | |
96 | /** | |
97 | * Returns foreign keys and entity references | |
98 | * | |
99 | * @return array | |
100 | * [CRM_Core_Reference_Interface] | |
101 | */ | |
102 | static function getReferenceColumns() { | |
346aaaba TO |
103 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
104 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
105 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'modified_id', 'civicrm_contact', 'id'); | |
106 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table'); | |
107 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
e501603b | 108 | } |
346aaaba | 109 | return Civi::$statics[__CLASS__]['links']; |
e501603b TO |
110 | } |
111 | /** | |
112 | * Returns all the column names of this table | |
113 | * | |
114 | * @return array | |
115 | */ | |
116 | static function &fields() { | |
346aaaba TO |
117 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
118 | Civi::$statics[__CLASS__]['fields'] = array( | |
e501603b TO |
119 | 'id' => array( |
120 | 'name' => 'id', | |
121 | 'type' => CRM_Utils_Type::T_INT, | |
122 | 'title' => ts('Log ID') , | |
123 | 'description' => 'Log ID', | |
124 | 'required' => true, | |
125 | ) , | |
126 | 'entity_table' => array( | |
127 | 'name' => 'entity_table', | |
128 | 'type' => CRM_Utils_Type::T_STRING, | |
129 | 'title' => ts('Entity Table') , | |
130 | 'description' => 'Name of table where item being referenced is stored.', | |
131 | 'required' => true, | |
132 | 'maxlength' => 64, | |
133 | 'size' => CRM_Utils_Type::BIG, | |
134 | ) , | |
135 | 'entity_id' => array( | |
136 | 'name' => 'entity_id', | |
137 | 'type' => CRM_Utils_Type::T_INT, | |
138 | 'title' => ts('Entity ID ') , | |
139 | 'description' => 'Foreign key to the referenced item.', | |
140 | 'required' => true, | |
141 | ) , | |
142 | 'data' => array( | |
143 | 'name' => 'data', | |
144 | 'type' => CRM_Utils_Type::T_TEXT, | |
145 | 'title' => ts('Data') , | |
146 | 'description' => 'Updates does to this object if any.', | |
147 | ) , | |
148 | 'modified_id' => array( | |
149 | 'name' => 'modified_id', | |
150 | 'type' => CRM_Utils_Type::T_INT, | |
151 | 'title' => ts('Modified By') , | |
152 | 'description' => 'FK to Contact ID of person under whose credentials this data modification was made.', | |
153 | 'FKClassName' => 'CRM_Contact_DAO_Contact', | |
154 | ) , | |
155 | 'modified_date' => array( | |
156 | 'name' => 'modified_date', | |
157 | 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, | |
158 | 'title' => ts('Modified Date') , | |
159 | 'description' => 'When was the referenced entity created or modified or deleted.', | |
160 | ) , | |
161 | ); | |
346aaaba | 162 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 163 | } |
346aaaba | 164 | return Civi::$statics[__CLASS__]['fields']; |
e501603b TO |
165 | } |
166 | /** | |
bd8e0b14 | 167 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
168 | * |
169 | * @return array | |
bd8e0b14 | 170 | * Array(string $name => string $uniqueName). |
e501603b TO |
171 | */ |
172 | static function &fieldKeys() { | |
bd8e0b14 TO |
173 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
174 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 175 | } |
bd8e0b14 | 176 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b TO |
177 | } |
178 | /** | |
179 | * Returns the names of this table | |
180 | * | |
181 | * @return string | |
182 | */ | |
183 | static function getTableName() { | |
184 | return self::$_tableName; | |
185 | } | |
186 | /** | |
187 | * Returns if this table needs to be logged | |
188 | * | |
189 | * @return boolean | |
190 | */ | |
191 | function getLog() { | |
192 | return self::$_log; | |
193 | } | |
194 | /** | |
195 | * Returns the list of fields that can be imported | |
196 | * | |
197 | * @param bool $prefix | |
198 | * | |
199 | * @return array | |
200 | */ | |
201 | static function &import($prefix = false) { | |
60808919 TO |
202 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'log', $prefix, array()); |
203 | return $r; | |
e501603b TO |
204 | } |
205 | /** | |
206 | * Returns the list of fields that can be exported | |
207 | * | |
208 | * @param bool $prefix | |
209 | * | |
210 | * @return array | |
211 | */ | |
212 | static function &export($prefix = false) { | |
60808919 TO |
213 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'log', $prefix, array()); |
214 | return $r; | |
e501603b TO |
215 | } |
216 | } |