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