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/Managed.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
69e13f9b | 9 | * (GenCodeChecksum:ca11b419bcdf2bce26609d9488527023) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the Managed entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_Managed extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '4.2'; | |
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_managed'; |
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 | * Surrogate Key | |
35 | * | |
e6ca0a57 | 36 | * @var int |
e501603b TO |
37 | */ |
38 | public $id; | |
c3fc2621 | 39 | |
e501603b TO |
40 | /** |
41 | * Name of the module which declared this object | |
42 | * | |
43 | * @var string | |
44 | */ | |
45 | public $module; | |
c3fc2621 | 46 | |
e501603b TO |
47 | /** |
48 | * Symbolic name used by the module to identify the object | |
49 | * | |
50 | * @var string | |
51 | */ | |
52 | public $name; | |
c3fc2621 | 53 | |
e501603b TO |
54 | /** |
55 | * API entity type | |
56 | * | |
57 | * @var string | |
58 | */ | |
59 | public $entity_type; | |
c3fc2621 | 60 | |
e501603b TO |
61 | /** |
62 | * Foreign key to the referenced item. | |
63 | * | |
e6ca0a57 | 64 | * @var int |
e501603b TO |
65 | */ |
66 | public $entity_id; | |
c3fc2621 | 67 | |
e501603b TO |
68 | /** |
69 | * Policy on when to cleanup entity (always, never, unused) | |
70 | * | |
71 | * @var string | |
72 | */ | |
73 | public $cleanup; | |
c3fc2621 | 74 | |
69e13f9b CW |
75 | /** |
76 | * When the managed entity was changed from its original settings. | |
77 | * | |
78 | * @var timestamp | |
79 | */ | |
80 | public $entity_modified_date; | |
81 | ||
e501603b | 82 | /** |
f41f0342 | 83 | * Class constructor. |
e501603b | 84 | */ |
c3fc2621 | 85 | public function __construct() { |
e501603b TO |
86 | $this->__table = 'civicrm_managed'; |
87 | parent::__construct(); | |
88 | } | |
c3fc2621 | 89 | |
449c4e6b CW |
90 | /** |
91 | * Returns localized title of this entity. | |
7b66c3b5 AH |
92 | * |
93 | * @param bool $plural | |
94 | * Whether to return the plural version of the title. | |
449c4e6b | 95 | */ |
7b66c3b5 AH |
96 | public static function getEntityTitle($plural = FALSE) { |
97 | return $plural ? ts('Manageds') : ts('Managed'); | |
449c4e6b CW |
98 | } |
99 | ||
e501603b TO |
100 | /** |
101 | * Returns all the column names of this table | |
102 | * | |
103 | * @return array | |
104 | */ | |
c3fc2621 | 105 | public static function &fields() { |
346aaaba | 106 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
107 | Civi::$statics[__CLASS__]['fields'] = [ |
108 | 'id' => [ | |
e501603b TO |
109 | 'name' => 'id', |
110 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 111 | 'title' => ts('Managed ID'), |
215b423e | 112 | 'description' => ts('Surrogate Key'), |
c3fc2621 | 113 | 'required' => TRUE, |
a36434b9 | 114 | 'where' => 'civicrm_managed.id', |
522a26c9 | 115 | 'table_name' => 'civicrm_managed', |
116 | 'entity' => 'Managed', | |
69e13f9b | 117 | 'bao' => 'CRM_Core_BAO_Managed', |
6a7e5e5d | 118 | 'localizable' => 0, |
2cbbebe8 A |
119 | 'html' => [ |
120 | 'type' => 'Number', | |
121 | ], | |
1fe423d6 | 122 | 'readonly' => TRUE, |
a9d0587b | 123 | 'add' => '4.2', |
c3fc2621 CW |
124 | ], |
125 | 'module' => [ | |
e501603b TO |
126 | 'name' => 'module', |
127 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 128 | 'title' => ts('Module'), |
215b423e | 129 | 'description' => ts('Name of the module which declared this object'), |
c3fc2621 | 130 | 'required' => TRUE, |
e501603b TO |
131 | 'maxlength' => 127, |
132 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 133 | 'where' => 'civicrm_managed.module', |
522a26c9 | 134 | 'table_name' => 'civicrm_managed', |
135 | 'entity' => 'Managed', | |
69e13f9b | 136 | 'bao' => 'CRM_Core_BAO_Managed', |
6a7e5e5d | 137 | 'localizable' => 0, |
a9d0587b | 138 | 'add' => '4.2', |
c3fc2621 CW |
139 | ], |
140 | 'name' => [ | |
e501603b TO |
141 | 'name' => 'name', |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 143 | 'title' => ts('Name'), |
215b423e | 144 | 'description' => ts('Symbolic name used by the module to identify the object'), |
e501603b TO |
145 | 'maxlength' => 127, |
146 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 147 | 'where' => 'civicrm_managed.name', |
522a26c9 | 148 | 'table_name' => 'civicrm_managed', |
149 | 'entity' => 'Managed', | |
69e13f9b | 150 | 'bao' => 'CRM_Core_BAO_Managed', |
6a7e5e5d | 151 | 'localizable' => 0, |
a9d0587b | 152 | 'add' => '4.2', |
c3fc2621 CW |
153 | ], |
154 | 'entity_type' => [ | |
e501603b TO |
155 | 'name' => 'entity_type', |
156 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 157 | 'title' => ts('Entity Type'), |
215b423e | 158 | 'description' => ts('API entity type'), |
c3fc2621 | 159 | 'required' => TRUE, |
e501603b TO |
160 | 'maxlength' => 64, |
161 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 162 | 'where' => 'civicrm_managed.entity_type', |
522a26c9 | 163 | 'table_name' => 'civicrm_managed', |
164 | 'entity' => 'Managed', | |
69e13f9b | 165 | 'bao' => 'CRM_Core_BAO_Managed', |
6a7e5e5d | 166 | 'localizable' => 0, |
a9d0587b | 167 | 'add' => '4.2', |
c3fc2621 CW |
168 | ], |
169 | 'entity_id' => [ | |
e501603b TO |
170 | 'name' => 'entity_id', |
171 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 172 | 'title' => ts('Entity ID'), |
215b423e | 173 | 'description' => ts('Foreign key to the referenced item.'), |
c3fc2621 | 174 | 'required' => TRUE, |
a36434b9 | 175 | 'where' => 'civicrm_managed.entity_id', |
522a26c9 | 176 | 'table_name' => 'civicrm_managed', |
177 | 'entity' => 'Managed', | |
69e13f9b | 178 | 'bao' => 'CRM_Core_BAO_Managed', |
6a7e5e5d | 179 | 'localizable' => 0, |
a9d0587b | 180 | 'add' => '4.2', |
c3fc2621 CW |
181 | ], |
182 | 'cleanup' => [ | |
e501603b TO |
183 | 'name' => 'cleanup', |
184 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 185 | 'title' => ts('Cleanup Setting'), |
215b423e | 186 | 'description' => ts('Policy on when to cleanup entity (always, never, unused)'), |
e501603b TO |
187 | 'maxlength' => 32, |
188 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 189 | 'where' => 'civicrm_managed.cleanup', |
522a26c9 | 190 | 'table_name' => 'civicrm_managed', |
191 | 'entity' => 'Managed', | |
69e13f9b | 192 | 'bao' => 'CRM_Core_BAO_Managed', |
6a7e5e5d | 193 | 'localizable' => 0, |
c3fc2621 | 194 | 'html' => [ |
e501603b | 195 | 'type' => 'Select', |
c3fc2621 CW |
196 | ], |
197 | 'pseudoconstant' => [ | |
e501603b | 198 | 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions', |
e6ca0a57 | 199 | ], |
a9d0587b | 200 | 'add' => '4.5', |
c3fc2621 | 201 | ], |
69e13f9b CW |
202 | 'entity_modified_date' => [ |
203 | 'name' => 'entity_modified_date', | |
204 | 'type' => CRM_Utils_Type::T_TIMESTAMP, | |
205 | 'title' => ts('Entity Modified Date'), | |
206 | 'description' => ts('When the managed entity was changed from its original settings.'), | |
207 | 'required' => FALSE, | |
208 | 'where' => 'civicrm_managed.entity_modified_date', | |
209 | 'default' => NULL, | |
210 | 'table_name' => 'civicrm_managed', | |
211 | 'entity' => 'Managed', | |
212 | 'bao' => 'CRM_Core_BAO_Managed', | |
213 | 'localizable' => 0, | |
214 | 'add' => '5.45', | |
215 | ], | |
c3fc2621 | 216 | ]; |
346aaaba | 217 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 218 | } |
346aaaba | 219 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 220 | } |
c3fc2621 | 221 | |
e501603b | 222 | /** |
bd8e0b14 | 223 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
224 | * |
225 | * @return array | |
bd8e0b14 | 226 | * Array(string $name => string $uniqueName). |
e501603b | 227 | */ |
c3fc2621 | 228 | public static function &fieldKeys() { |
bd8e0b14 TO |
229 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
230 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 231 | } |
bd8e0b14 | 232 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 233 | } |
c3fc2621 | 234 | |
e501603b TO |
235 | /** |
236 | * Returns the names of this table | |
237 | * | |
238 | * @return string | |
239 | */ | |
c3fc2621 | 240 | public static function getTableName() { |
e501603b TO |
241 | return self::$_tableName; |
242 | } | |
c3fc2621 | 243 | |
e501603b TO |
244 | /** |
245 | * Returns if this table needs to be logged | |
246 | * | |
c3fc2621 | 247 | * @return bool |
e501603b | 248 | */ |
c3fc2621 | 249 | public function getLog() { |
e501603b TO |
250 | return self::$_log; |
251 | } | |
c3fc2621 | 252 | |
e501603b TO |
253 | /** |
254 | * Returns the list of fields that can be imported | |
255 | * | |
256 | * @param bool $prefix | |
257 | * | |
258 | * @return array | |
259 | */ | |
c3fc2621 CW |
260 | public static function &import($prefix = FALSE) { |
261 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'managed', $prefix, []); | |
60808919 | 262 | return $r; |
e501603b | 263 | } |
c3fc2621 | 264 | |
e501603b TO |
265 | /** |
266 | * Returns the list of fields that can be exported | |
267 | * | |
268 | * @param bool $prefix | |
269 | * | |
270 | * @return array | |
271 | */ | |
c3fc2621 CW |
272 | public static function &export($prefix = FALSE) { |
273 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'managed', $prefix, []); | |
60808919 | 274 | return $r; |
e501603b | 275 | } |
c3fc2621 | 276 | |
e7a6b91a AS |
277 | /** |
278 | * Returns the list of indices | |
c3fc2621 CW |
279 | * |
280 | * @param bool $localize | |
281 | * | |
282 | * @return array | |
e7a6b91a AS |
283 | */ |
284 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
285 | $indices = [ |
286 | 'UI_managed_module_name' => [ | |
e7a6b91a | 287 | 'name' => 'UI_managed_module_name', |
c3fc2621 | 288 | 'field' => [ |
e7a6b91a AS |
289 | 0 => 'module', |
290 | 1 => 'name', | |
c3fc2621 CW |
291 | ], |
292 | 'localizable' => FALSE, | |
e7a6b91a | 293 | 'sig' => 'civicrm_managed::0::module::name', |
c3fc2621 CW |
294 | ], |
295 | 'UI_managed_entity' => [ | |
e7a6b91a | 296 | 'name' => 'UI_managed_entity', |
c3fc2621 | 297 | 'field' => [ |
e7a6b91a AS |
298 | 0 => 'entity_type', |
299 | 1 => 'entity_id', | |
c3fc2621 CW |
300 | ], |
301 | 'localizable' => FALSE, | |
e7a6b91a | 302 | 'sig' => 'civicrm_managed::0::entity_type::entity_id', |
c3fc2621 CW |
303 | ], |
304 | ]; | |
e7a6b91a AS |
305 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
306 | } | |
c3fc2621 | 307 | |
e501603b | 308 | } |