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 | |
929a1c14 | 9 | * (GenCodeChecksum:e6146e35f8c8321e600a4198cbd6949e) |
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 | |
e501603b | 75 | /** |
f41f0342 | 76 | * Class constructor. |
e501603b | 77 | */ |
c3fc2621 | 78 | public function __construct() { |
e501603b TO |
79 | $this->__table = 'civicrm_managed'; |
80 | parent::__construct(); | |
81 | } | |
c3fc2621 | 82 | |
449c4e6b CW |
83 | /** |
84 | * Returns localized title of this entity. | |
85 | */ | |
86 | public static function getEntityTitle() { | |
87 | return ts('Manageds'); | |
88 | } | |
89 | ||
e501603b TO |
90 | /** |
91 | * Returns all the column names of this table | |
92 | * | |
93 | * @return array | |
94 | */ | |
c3fc2621 | 95 | public static function &fields() { |
346aaaba | 96 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
97 | Civi::$statics[__CLASS__]['fields'] = [ |
98 | 'id' => [ | |
e501603b TO |
99 | 'name' => 'id', |
100 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 101 | 'title' => ts('Managed ID'), |
215b423e | 102 | 'description' => ts('Surrogate Key'), |
c3fc2621 | 103 | 'required' => TRUE, |
a36434b9 | 104 | 'where' => 'civicrm_managed.id', |
522a26c9 | 105 | 'table_name' => 'civicrm_managed', |
106 | 'entity' => 'Managed', | |
107 | 'bao' => 'CRM_Core_DAO_Managed', | |
6a7e5e5d | 108 | 'localizable' => 0, |
a9d0587b | 109 | 'add' => '4.2', |
c3fc2621 CW |
110 | ], |
111 | 'module' => [ | |
e501603b TO |
112 | 'name' => 'module', |
113 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 114 | 'title' => ts('Module'), |
215b423e | 115 | 'description' => ts('Name of the module which declared this object'), |
c3fc2621 | 116 | 'required' => TRUE, |
e501603b TO |
117 | 'maxlength' => 127, |
118 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 119 | 'where' => 'civicrm_managed.module', |
522a26c9 | 120 | 'table_name' => 'civicrm_managed', |
121 | 'entity' => 'Managed', | |
122 | 'bao' => 'CRM_Core_DAO_Managed', | |
6a7e5e5d | 123 | 'localizable' => 0, |
a9d0587b | 124 | 'add' => '4.2', |
c3fc2621 CW |
125 | ], |
126 | 'name' => [ | |
e501603b TO |
127 | 'name' => 'name', |
128 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 129 | 'title' => ts('Name'), |
215b423e | 130 | 'description' => ts('Symbolic name used by the module to identify the object'), |
e501603b TO |
131 | 'maxlength' => 127, |
132 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 133 | 'where' => 'civicrm_managed.name', |
522a26c9 | 134 | 'table_name' => 'civicrm_managed', |
135 | 'entity' => 'Managed', | |
136 | 'bao' => 'CRM_Core_DAO_Managed', | |
6a7e5e5d | 137 | 'localizable' => 0, |
a9d0587b | 138 | 'add' => '4.2', |
c3fc2621 CW |
139 | ], |
140 | 'entity_type' => [ | |
e501603b TO |
141 | 'name' => 'entity_type', |
142 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 143 | 'title' => ts('Entity Type'), |
215b423e | 144 | 'description' => ts('API entity type'), |
c3fc2621 | 145 | 'required' => TRUE, |
e501603b TO |
146 | 'maxlength' => 64, |
147 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 148 | 'where' => 'civicrm_managed.entity_type', |
522a26c9 | 149 | 'table_name' => 'civicrm_managed', |
150 | 'entity' => 'Managed', | |
151 | 'bao' => 'CRM_Core_DAO_Managed', | |
6a7e5e5d | 152 | 'localizable' => 0, |
a9d0587b | 153 | 'add' => '4.2', |
c3fc2621 CW |
154 | ], |
155 | 'entity_id' => [ | |
e501603b TO |
156 | 'name' => 'entity_id', |
157 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 158 | 'title' => ts('Entity ID'), |
215b423e | 159 | 'description' => ts('Foreign key to the referenced item.'), |
c3fc2621 | 160 | 'required' => TRUE, |
a36434b9 | 161 | 'where' => 'civicrm_managed.entity_id', |
522a26c9 | 162 | 'table_name' => 'civicrm_managed', |
163 | 'entity' => 'Managed', | |
164 | 'bao' => 'CRM_Core_DAO_Managed', | |
6a7e5e5d | 165 | 'localizable' => 0, |
a9d0587b | 166 | 'add' => '4.2', |
c3fc2621 CW |
167 | ], |
168 | 'cleanup' => [ | |
e501603b TO |
169 | 'name' => 'cleanup', |
170 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 171 | 'title' => ts('Cleanup Setting'), |
215b423e | 172 | 'description' => ts('Policy on when to cleanup entity (always, never, unused)'), |
e501603b TO |
173 | 'maxlength' => 32, |
174 | 'size' => CRM_Utils_Type::MEDIUM, | |
a36434b9 | 175 | 'where' => 'civicrm_managed.cleanup', |
522a26c9 | 176 | 'table_name' => 'civicrm_managed', |
177 | 'entity' => 'Managed', | |
178 | 'bao' => 'CRM_Core_DAO_Managed', | |
6a7e5e5d | 179 | 'localizable' => 0, |
c3fc2621 | 180 | 'html' => [ |
e501603b | 181 | 'type' => 'Select', |
c3fc2621 CW |
182 | ], |
183 | 'pseudoconstant' => [ | |
e501603b | 184 | 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions', |
e6ca0a57 | 185 | ], |
a9d0587b | 186 | 'add' => '4.5', |
c3fc2621 CW |
187 | ], |
188 | ]; | |
346aaaba | 189 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 190 | } |
346aaaba | 191 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 192 | } |
c3fc2621 | 193 | |
e501603b | 194 | /** |
bd8e0b14 | 195 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
196 | * |
197 | * @return array | |
bd8e0b14 | 198 | * Array(string $name => string $uniqueName). |
e501603b | 199 | */ |
c3fc2621 | 200 | public static function &fieldKeys() { |
bd8e0b14 TO |
201 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
202 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 203 | } |
bd8e0b14 | 204 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 205 | } |
c3fc2621 | 206 | |
e501603b TO |
207 | /** |
208 | * Returns the names of this table | |
209 | * | |
210 | * @return string | |
211 | */ | |
c3fc2621 | 212 | public static function getTableName() { |
e501603b TO |
213 | return self::$_tableName; |
214 | } | |
c3fc2621 | 215 | |
e501603b TO |
216 | /** |
217 | * Returns if this table needs to be logged | |
218 | * | |
c3fc2621 | 219 | * @return bool |
e501603b | 220 | */ |
c3fc2621 | 221 | public function getLog() { |
e501603b TO |
222 | return self::$_log; |
223 | } | |
c3fc2621 | 224 | |
e501603b TO |
225 | /** |
226 | * Returns the list of fields that can be imported | |
227 | * | |
228 | * @param bool $prefix | |
229 | * | |
230 | * @return array | |
231 | */ | |
c3fc2621 CW |
232 | public static function &import($prefix = FALSE) { |
233 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'managed', $prefix, []); | |
60808919 | 234 | return $r; |
e501603b | 235 | } |
c3fc2621 | 236 | |
e501603b TO |
237 | /** |
238 | * Returns the list of fields that can be exported | |
239 | * | |
240 | * @param bool $prefix | |
241 | * | |
242 | * @return array | |
243 | */ | |
c3fc2621 CW |
244 | public static function &export($prefix = FALSE) { |
245 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'managed', $prefix, []); | |
60808919 | 246 | return $r; |
e501603b | 247 | } |
c3fc2621 | 248 | |
e7a6b91a AS |
249 | /** |
250 | * Returns the list of indices | |
c3fc2621 CW |
251 | * |
252 | * @param bool $localize | |
253 | * | |
254 | * @return array | |
e7a6b91a AS |
255 | */ |
256 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
257 | $indices = [ |
258 | 'UI_managed_module_name' => [ | |
e7a6b91a | 259 | 'name' => 'UI_managed_module_name', |
c3fc2621 | 260 | 'field' => [ |
e7a6b91a AS |
261 | 0 => 'module', |
262 | 1 => 'name', | |
c3fc2621 CW |
263 | ], |
264 | 'localizable' => FALSE, | |
e7a6b91a | 265 | 'sig' => 'civicrm_managed::0::module::name', |
c3fc2621 CW |
266 | ], |
267 | 'UI_managed_entity' => [ | |
e7a6b91a | 268 | 'name' => 'UI_managed_entity', |
c3fc2621 | 269 | 'field' => [ |
e7a6b91a AS |
270 | 0 => 'entity_type', |
271 | 1 => 'entity_id', | |
c3fc2621 CW |
272 | ], |
273 | 'localizable' => FALSE, | |
e7a6b91a | 274 | 'sig' => 'civicrm_managed::0::entity_type::entity_id', |
c3fc2621 CW |
275 | ], |
276 | ]; | |
e7a6b91a AS |
277 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
278 | } | |
c3fc2621 | 279 | |
e501603b | 280 | } |