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