Merge pull request #17480 from tunbola/email-template-perms
[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:939c0ed6422323450f5b9b00f8da85ad)
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 'add' => '4.2',
108 ],
109 'module' => [
110 'name' => 'module',
111 'type' => CRM_Utils_Type::T_STRING,
112 'title' => ts('Module'),
113 'description' => ts('Name of the module which declared this object'),
114 'required' => TRUE,
115 'maxlength' => 127,
116 'size' => CRM_Utils_Type::HUGE,
117 'where' => 'civicrm_managed.module',
118 'table_name' => 'civicrm_managed',
119 'entity' => 'Managed',
120 'bao' => 'CRM_Core_DAO_Managed',
121 'localizable' => 0,
122 'add' => '4.2',
123 ],
124 'name' => [
125 'name' => 'name',
126 'type' => CRM_Utils_Type::T_STRING,
127 'title' => ts('Name'),
128 'description' => ts('Symbolic name used by the module to identify the object'),
129 'maxlength' => 127,
130 'size' => CRM_Utils_Type::HUGE,
131 'where' => 'civicrm_managed.name',
132 'table_name' => 'civicrm_managed',
133 'entity' => 'Managed',
134 'bao' => 'CRM_Core_DAO_Managed',
135 'localizable' => 0,
136 'add' => '4.2',
137 ],
138 'entity_type' => [
139 'name' => 'entity_type',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Entity Type'),
142 'description' => ts('API entity type'),
143 'required' => TRUE,
144 'maxlength' => 64,
145 'size' => CRM_Utils_Type::BIG,
146 'where' => 'civicrm_managed.entity_type',
147 'table_name' => 'civicrm_managed',
148 'entity' => 'Managed',
149 'bao' => 'CRM_Core_DAO_Managed',
150 'localizable' => 0,
151 'add' => '4.2',
152 ],
153 'entity_id' => [
154 'name' => 'entity_id',
155 'type' => CRM_Utils_Type::T_INT,
156 'title' => ts('Entity ID'),
157 'description' => ts('Foreign key to the referenced item.'),
158 'required' => TRUE,
159 'where' => 'civicrm_managed.entity_id',
160 'table_name' => 'civicrm_managed',
161 'entity' => 'Managed',
162 'bao' => 'CRM_Core_DAO_Managed',
163 'localizable' => 0,
164 'add' => '4.2',
165 ],
166 'cleanup' => [
167 'name' => 'cleanup',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('Cleanup Setting'),
170 'description' => ts('Policy on when to cleanup entity (always, never, unused)'),
171 'maxlength' => 32,
172 'size' => CRM_Utils_Type::MEDIUM,
173 'where' => 'civicrm_managed.cleanup',
174 'table_name' => 'civicrm_managed',
175 'entity' => 'Managed',
176 'bao' => 'CRM_Core_DAO_Managed',
177 'localizable' => 0,
178 'html' => [
179 'type' => 'Select',
180 ],
181 'pseudoconstant' => [
182 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions',
183 ],
184 'add' => '4.5',
185 ],
186 ];
187 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
188 }
189 return Civi::$statics[__CLASS__]['fields'];
190 }
191
192 /**
193 * Return a mapping from field-name to the corresponding key (as used in fields()).
194 *
195 * @return array
196 * Array(string $name => string $uniqueName).
197 */
198 public static function &fieldKeys() {
199 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
200 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
201 }
202 return Civi::$statics[__CLASS__]['fieldKeys'];
203 }
204
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
210 public static function getTableName() {
211 return self::$_tableName;
212 }
213
214 /**
215 * Returns if this table needs to be logged
216 *
217 * @return bool
218 */
219 public function getLog() {
220 return self::$_log;
221 }
222
223 /**
224 * Returns the list of fields that can be imported
225 *
226 * @param bool $prefix
227 *
228 * @return array
229 */
230 public static function &import($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'managed', $prefix, []);
232 return $r;
233 }
234
235 /**
236 * Returns the list of fields that can be exported
237 *
238 * @param bool $prefix
239 *
240 * @return array
241 */
242 public static function &export($prefix = FALSE) {
243 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'managed', $prefix, []);
244 return $r;
245 }
246
247 /**
248 * Returns the list of indices
249 *
250 * @param bool $localize
251 *
252 * @return array
253 */
254 public static function indices($localize = TRUE) {
255 $indices = [
256 'UI_managed_module_name' => [
257 'name' => 'UI_managed_module_name',
258 'field' => [
259 0 => 'module',
260 1 => 'name',
261 ],
262 'localizable' => FALSE,
263 'sig' => 'civicrm_managed::0::module::name',
264 ],
265 'UI_managed_entity' => [
266 'name' => 'UI_managed_entity',
267 'field' => [
268 0 => 'entity_type',
269 1 => 'entity_id',
270 ],
271 'localizable' => FALSE,
272 'sig' => 'civicrm_managed::0::entity_type::entity_id',
273 ],
274 ];
275 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
276 }
277
278 }