Merge pull request #13337 from GinkgoFJG/crmPageTitle
[civicrm-core.git] / CRM / Core / DAO / Managed.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Managed.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:47e95661423fb2f97b3fd2069c4e404f)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Managed entity.
f41f0342 14 */
e501603b 15class 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 */
22 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 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b
TO
31 /**
32 * Surrogate Key
33 *
34 * @var int unsigned
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 *
62 * @var int unsigned
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,
522a26c9 95 'table_name' => 'civicrm_managed',
96 'entity' => 'Managed',
97 'bao' => 'CRM_Core_DAO_Managed',
6a7e5e5d 98 'localizable' => 0,
c3fc2621
CW
99 ],
100 'module' => [
e501603b
TO
101 'name' => 'module',
102 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 103 'title' => ts('Module'),
215b423e 104 'description' => ts('Name of the module which declared this object'),
c3fc2621 105 'required' => TRUE,
e501603b
TO
106 'maxlength' => 127,
107 'size' => CRM_Utils_Type::HUGE,
522a26c9 108 'table_name' => 'civicrm_managed',
109 'entity' => 'Managed',
110 'bao' => 'CRM_Core_DAO_Managed',
6a7e5e5d 111 'localizable' => 0,
c3fc2621
CW
112 ],
113 'name' => [
e501603b
TO
114 'name' => 'name',
115 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 116 'title' => ts('Name'),
215b423e 117 'description' => ts('Symbolic name used by the module to identify the object'),
e501603b
TO
118 'maxlength' => 127,
119 'size' => CRM_Utils_Type::HUGE,
522a26c9 120 'table_name' => 'civicrm_managed',
121 'entity' => 'Managed',
122 'bao' => 'CRM_Core_DAO_Managed',
6a7e5e5d 123 'localizable' => 0,
c3fc2621
CW
124 ],
125 'entity_type' => [
e501603b
TO
126 'name' => 'entity_type',
127 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 128 'title' => ts('Entity Type'),
215b423e 129 'description' => ts('API entity type'),
c3fc2621 130 'required' => TRUE,
e501603b
TO
131 'maxlength' => 64,
132 'size' => CRM_Utils_Type::BIG,
522a26c9 133 'table_name' => 'civicrm_managed',
134 'entity' => 'Managed',
135 'bao' => 'CRM_Core_DAO_Managed',
6a7e5e5d 136 'localizable' => 0,
c3fc2621
CW
137 ],
138 'entity_id' => [
e501603b
TO
139 'name' => 'entity_id',
140 'type' => CRM_Utils_Type::T_INT,
c3fc2621 141 'title' => ts('Entity ID'),
215b423e 142 'description' => ts('Foreign key to the referenced item.'),
c3fc2621 143 'required' => TRUE,
522a26c9 144 'table_name' => 'civicrm_managed',
145 'entity' => 'Managed',
146 'bao' => 'CRM_Core_DAO_Managed',
6a7e5e5d 147 'localizable' => 0,
c3fc2621
CW
148 ],
149 'cleanup' => [
e501603b
TO
150 'name' => 'cleanup',
151 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 152 'title' => ts('Cleanup Setting'),
215b423e 153 'description' => ts('Policy on when to cleanup entity (always, never, unused)'),
e501603b
TO
154 'maxlength' => 32,
155 'size' => CRM_Utils_Type::MEDIUM,
522a26c9 156 'table_name' => 'civicrm_managed',
157 'entity' => 'Managed',
158 'bao' => 'CRM_Core_DAO_Managed',
6a7e5e5d 159 'localizable' => 0,
c3fc2621 160 'html' => [
e501603b 161 'type' => 'Select',
c3fc2621
CW
162 ],
163 'pseudoconstant' => [
e501603b 164 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions',
c3fc2621
CW
165 ]
166 ],
167 ];
346aaaba 168 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 169 }
346aaaba 170 return Civi::$statics[__CLASS__]['fields'];
e501603b 171 }
c3fc2621 172
e501603b 173 /**
bd8e0b14 174 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
175 *
176 * @return array
bd8e0b14 177 * Array(string $name => string $uniqueName).
e501603b 178 */
c3fc2621 179 public static function &fieldKeys() {
bd8e0b14
TO
180 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
181 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 182 }
bd8e0b14 183 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 184 }
c3fc2621 185
e501603b
TO
186 /**
187 * Returns the names of this table
188 *
189 * @return string
190 */
c3fc2621 191 public static function getTableName() {
e501603b
TO
192 return self::$_tableName;
193 }
c3fc2621 194
e501603b
TO
195 /**
196 * Returns if this table needs to be logged
197 *
c3fc2621 198 * @return bool
e501603b 199 */
c3fc2621 200 public function getLog() {
e501603b
TO
201 return self::$_log;
202 }
c3fc2621 203
e501603b
TO
204 /**
205 * Returns the list of fields that can be imported
206 *
207 * @param bool $prefix
208 *
209 * @return array
210 */
c3fc2621
CW
211 public static function &import($prefix = FALSE) {
212 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'managed', $prefix, []);
60808919 213 return $r;
e501603b 214 }
c3fc2621 215
e501603b
TO
216 /**
217 * Returns the list of fields that can be exported
218 *
219 * @param bool $prefix
220 *
221 * @return array
222 */
c3fc2621
CW
223 public static function &export($prefix = FALSE) {
224 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'managed', $prefix, []);
60808919 225 return $r;
e501603b 226 }
c3fc2621 227
e7a6b91a
AS
228 /**
229 * Returns the list of indices
c3fc2621
CW
230 *
231 * @param bool $localize
232 *
233 * @return array
e7a6b91a
AS
234 */
235 public static function indices($localize = TRUE) {
c3fc2621
CW
236 $indices = [
237 'UI_managed_module_name' => [
e7a6b91a 238 'name' => 'UI_managed_module_name',
c3fc2621 239 'field' => [
e7a6b91a
AS
240 0 => 'module',
241 1 => 'name',
c3fc2621
CW
242 ],
243 'localizable' => FALSE,
e7a6b91a 244 'sig' => 'civicrm_managed::0::module::name',
c3fc2621
CW
245 ],
246 'UI_managed_entity' => [
e7a6b91a 247 'name' => 'UI_managed_entity',
c3fc2621 248 'field' => [
e7a6b91a
AS
249 0 => 'entity_type',
250 1 => 'entity_id',
c3fc2621
CW
251 ],
252 'localizable' => FALSE,
e7a6b91a 253 'sig' => 'civicrm_managed::0::entity_type::entity_id',
c3fc2621
CW
254 ],
255 ];
e7a6b91a
AS
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
257 }
c3fc2621 258
e501603b 259}