5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Managed.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:54b79cae396d1c5044406fc97ae60352)
13 * Database access object for the Managed entity.
15 class CRM_Core_DAO_Managed
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.2';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_managed';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Name of the module which declared this object
46 * (SQL type: varchar(127))
47 * Note that values will be retrieved from the database as a string.
52 * Symbolic name used by the module to identify the object
55 * (SQL type: varchar(127))
56 * Note that values will be retrieved from the database as a string.
64 * (SQL type: varchar(64))
65 * Note that values will be retrieved from the database as a string.
70 * Foreign key to the referenced item.
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
79 * Policy on when to cleanup entity (always, never, unused)
82 * (SQL type: varchar(32))
83 * Note that values will be retrieved from the database as a string.
88 * When the managed entity was changed from its original settings.
91 * (SQL type: timestamp)
92 * Note that values will be retrieved from the database as a string.
94 public $entity_modified_date;
99 public function __construct() {
100 $this->__table
= 'civicrm_managed';
101 parent
::__construct();
105 * Returns localized title of this entity.
107 * @param bool $plural
108 * Whether to return the plural version of the title.
110 public static function getEntityTitle($plural = FALSE) {
111 return $plural ?
ts('Manageds') : ts('Managed');
115 * Returns all the column names of this table
119 public static function &fields() {
120 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
121 Civi
::$statics[__CLASS__
]['fields'] = [
124 'type' => CRM_Utils_Type
::T_INT
,
125 'title' => ts('Managed ID'),
126 'description' => ts('Surrogate Key'),
128 'where' => 'civicrm_managed.id',
129 'table_name' => 'civicrm_managed',
130 'entity' => 'Managed',
131 'bao' => 'CRM_Core_BAO_Managed',
141 'type' => CRM_Utils_Type
::T_STRING
,
142 'title' => ts('Module'),
143 'description' => ts('Name of the module which declared this object'),
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',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Name'),
158 'description' => ts('Symbolic name used by the module to identify the object'),
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',
169 'name' => 'entity_type',
170 'type' => CRM_Utils_Type
::T_STRING
,
171 'title' => ts('Entity Type'),
172 'description' => ts('API entity type'),
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',
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.'),
189 'where' => 'civicrm_managed.entity_id',
190 'table_name' => 'civicrm_managed',
191 'entity' => 'Managed',
192 'bao' => 'CRM_Core_BAO_Managed',
198 'type' => CRM_Utils_Type
::T_STRING
,
199 'title' => ts('Cleanup Setting'),
200 'description' => ts('Policy on when to cleanup entity (always, never, unused)'),
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',
211 'pseudoconstant' => [
212 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions',
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.'),
222 'where' => 'civicrm_managed.entity_modified_date',
224 'table_name' => 'civicrm_managed',
225 'entity' => 'Managed',
226 'bao' => 'CRM_Core_BAO_Managed',
231 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
233 return Civi
::$statics[__CLASS__
]['fields'];
237 * Return a mapping from field-name to the corresponding key (as used in fields()).
240 * Array(string $name => string $uniqueName).
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()));
246 return Civi
::$statics[__CLASS__
]['fieldKeys'];
250 * Returns the names of this table
254 public static function getTableName() {
255 return self
::$_tableName;
259 * Returns if this table needs to be logged
263 public function getLog() {
268 * Returns the list of fields that can be imported
270 * @param bool $prefix
274 public static function &import($prefix = FALSE) {
275 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'managed', $prefix, []);
280 * Returns the list of fields that can be exported
282 * @param bool $prefix
286 public static function &export($prefix = FALSE) {
287 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'managed', $prefix, []);
292 * Returns the list of indices
294 * @param bool $localize
298 public static function indices($localize = TRUE) {
300 'UI_managed_module_name' => [
301 'name' => 'UI_managed_module_name',
306 'localizable' => FALSE,
307 'sig' => 'civicrm_managed::0::module::name',
309 'UI_managed_entity' => [
310 'name' => 'UI_managed_entity',
315 'localizable' => FALSE,
316 'sig' => 'civicrm_managed::0::entity_type::entity_id',
319 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;