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