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:ca11b419bcdf2bce26609d9488527023)
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;
41 * Name of the module which declared this object
48 * Symbolic name used by the module to identify the object
62 * Foreign key to the referenced item.
69 * Policy on when to cleanup entity (always, never, unused)
76 * When the managed entity was changed from its original settings.
80 public $entity_modified_date;
85 public function __construct() {
86 $this->__table
= 'civicrm_managed';
87 parent
::__construct();
91 * Returns localized title of this entity.
94 * Whether to return the plural version of the title.
96 public static function getEntityTitle($plural = FALSE) {
97 return $plural ?
ts('Manageds') : ts('Managed');
101 * Returns all the column names of this table
105 public static function &fields() {
106 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
107 Civi
::$statics[__CLASS__
]['fields'] = [
110 'type' => CRM_Utils_Type
::T_INT
,
111 'title' => ts('Managed ID'),
112 'description' => ts('Surrogate Key'),
114 'where' => 'civicrm_managed.id',
115 'table_name' => 'civicrm_managed',
116 'entity' => 'Managed',
117 'bao' => 'CRM_Core_BAO_Managed',
127 'type' => CRM_Utils_Type
::T_STRING
,
128 'title' => ts('Module'),
129 'description' => ts('Name of the module which declared this object'),
132 'size' => CRM_Utils_Type
::HUGE
,
133 'where' => 'civicrm_managed.module',
134 'table_name' => 'civicrm_managed',
135 'entity' => 'Managed',
136 'bao' => 'CRM_Core_BAO_Managed',
142 'type' => CRM_Utils_Type
::T_STRING
,
143 'title' => ts('Name'),
144 'description' => ts('Symbolic name used by the module to identify the object'),
146 'size' => CRM_Utils_Type
::HUGE
,
147 'where' => 'civicrm_managed.name',
148 'table_name' => 'civicrm_managed',
149 'entity' => 'Managed',
150 'bao' => 'CRM_Core_BAO_Managed',
155 'name' => 'entity_type',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Entity Type'),
158 'description' => ts('API entity type'),
161 'size' => CRM_Utils_Type
::BIG
,
162 'where' => 'civicrm_managed.entity_type',
163 'table_name' => 'civicrm_managed',
164 'entity' => 'Managed',
165 'bao' => 'CRM_Core_BAO_Managed',
170 'name' => 'entity_id',
171 'type' => CRM_Utils_Type
::T_INT
,
172 'title' => ts('Entity ID'),
173 'description' => ts('Foreign key to the referenced item.'),
175 'where' => 'civicrm_managed.entity_id',
176 'table_name' => 'civicrm_managed',
177 'entity' => 'Managed',
178 'bao' => 'CRM_Core_BAO_Managed',
184 'type' => CRM_Utils_Type
::T_STRING
,
185 'title' => ts('Cleanup Setting'),
186 'description' => ts('Policy on when to cleanup entity (always, never, unused)'),
188 'size' => CRM_Utils_Type
::MEDIUM
,
189 'where' => 'civicrm_managed.cleanup',
190 'table_name' => 'civicrm_managed',
191 'entity' => 'Managed',
192 'bao' => 'CRM_Core_BAO_Managed',
197 'pseudoconstant' => [
198 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions',
202 'entity_modified_date' => [
203 'name' => 'entity_modified_date',
204 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
205 'title' => ts('Entity Modified Date'),
206 'description' => ts('When the managed entity was changed from its original settings.'),
208 'where' => 'civicrm_managed.entity_modified_date',
210 'table_name' => 'civicrm_managed',
211 'entity' => 'Managed',
212 'bao' => 'CRM_Core_BAO_Managed',
217 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
219 return Civi
::$statics[__CLASS__
]['fields'];
223 * Return a mapping from field-name to the corresponding key (as used in fields()).
226 * Array(string $name => string $uniqueName).
228 public static function &fieldKeys() {
229 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
230 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
232 return Civi
::$statics[__CLASS__
]['fieldKeys'];
236 * Returns the names of this table
240 public static function getTableName() {
241 return self
::$_tableName;
245 * Returns if this table needs to be logged
249 public function getLog() {
254 * Returns the list of fields that can be imported
256 * @param bool $prefix
260 public static function &import($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'managed', $prefix, []);
266 * Returns the list of fields that can be exported
268 * @param bool $prefix
272 public static function &export($prefix = FALSE) {
273 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'managed', $prefix, []);
278 * Returns the list of indices
280 * @param bool $localize
284 public static function indices($localize = TRUE) {
286 'UI_managed_module_name' => [
287 'name' => 'UI_managed_module_name',
292 'localizable' => FALSE,
293 'sig' => 'civicrm_managed::0::module::name',
295 'UI_managed_entity' => [
296 'name' => 'UI_managed_entity',
301 'localizable' => FALSE,
302 'sig' => 'civicrm_managed::0::entity_type::entity_id',
305 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;