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