API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / Component.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Component.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a9d0587b 9 * (GenCodeChecksum:1f7be99fb2d2adfebdf3faa2013666f4)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Component entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Component extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_component';
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 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Component ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Name of the component.
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b 45 /**
fb607354 46 * Path to components main directory in a form of a class namespace.
e501603b
TO
47 *
48 * @var string
49 */
50 public $namespace;
c3fc2621 51
e501603b 52 /**
f41f0342 53 * Class constructor.
e501603b 54 */
c3fc2621 55 public function __construct() {
e501603b
TO
56 $this->__table = 'civicrm_component';
57 parent::__construct();
58 }
c3fc2621 59
449c4e6b
CW
60 /**
61 * Returns localized title of this entity.
62 */
63 public static function getEntityTitle() {
64 return ts('Components');
65 }
66
e501603b
TO
67 /**
68 * Returns all the column names of this table
69 *
70 * @return array
71 */
c3fc2621 72 public static function &fields() {
346aaaba 73 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
74 Civi::$statics[__CLASS__]['fields'] = [
75 'id' => [
e501603b
TO
76 'name' => 'id',
77 'type' => CRM_Utils_Type::T_INT,
52f56bf0 78 'title' => ts('Component ID'),
215b423e 79 'description' => ts('Component ID'),
c3fc2621 80 'required' => TRUE,
a36434b9 81 'where' => 'civicrm_component.id',
522a26c9 82 'table_name' => 'civicrm_component',
83 'entity' => 'Component',
84 'bao' => 'CRM_Core_DAO_Component',
6a7e5e5d 85 'localizable' => 0,
a9d0587b 86 'add' => '2.0',
c3fc2621
CW
87 ],
88 'name' => [
e501603b
TO
89 'name' => 'name',
90 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 91 'title' => ts('Component name'),
215b423e 92 'description' => ts('Name of the component.'),
c3fc2621 93 'required' => TRUE,
e501603b
TO
94 'maxlength' => 64,
95 'size' => CRM_Utils_Type::BIG,
a36434b9 96 'where' => 'civicrm_component.name',
522a26c9 97 'table_name' => 'civicrm_component',
98 'entity' => 'Component',
99 'bao' => 'CRM_Core_DAO_Component',
6a7e5e5d 100 'localizable' => 0,
a9d0587b 101 'add' => '2.0',
c3fc2621
CW
102 ],
103 'namespace' => [
e501603b
TO
104 'name' => 'namespace',
105 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 106 'title' => ts('Namespace reserved for component.'),
fb607354 107 'description' => ts('Path to components main directory in a form of a class namespace.'),
e501603b
TO
108 'maxlength' => 128,
109 'size' => CRM_Utils_Type::HUGE,
a36434b9 110 'where' => 'civicrm_component.namespace',
522a26c9 111 'table_name' => 'civicrm_component',
112 'entity' => 'Component',
113 'bao' => 'CRM_Core_DAO_Component',
6a7e5e5d 114 'localizable' => 0,
a9d0587b 115 'add' => '2.0',
c3fc2621
CW
116 ],
117 ];
346aaaba 118 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 119 }
346aaaba 120 return Civi::$statics[__CLASS__]['fields'];
e501603b 121 }
c3fc2621 122
e501603b 123 /**
bd8e0b14 124 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
125 *
126 * @return array
bd8e0b14 127 * Array(string $name => string $uniqueName).
e501603b 128 */
c3fc2621 129 public static function &fieldKeys() {
bd8e0b14
TO
130 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
131 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 132 }
bd8e0b14 133 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 134 }
c3fc2621 135
e501603b
TO
136 /**
137 * Returns the names of this table
138 *
139 * @return string
140 */
c3fc2621 141 public static function getTableName() {
e501603b
TO
142 return self::$_tableName;
143 }
c3fc2621 144
e501603b
TO
145 /**
146 * Returns if this table needs to be logged
147 *
c3fc2621 148 * @return bool
e501603b 149 */
c3fc2621 150 public function getLog() {
e501603b
TO
151 return self::$_log;
152 }
c3fc2621 153
e501603b
TO
154 /**
155 * Returns the list of fields that can be imported
156 *
157 * @param bool $prefix
158 *
159 * @return array
160 */
c3fc2621
CW
161 public static function &import($prefix = FALSE) {
162 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'component', $prefix, []);
60808919 163 return $r;
e501603b 164 }
c3fc2621 165
e501603b
TO
166 /**
167 * Returns the list of fields that can be exported
168 *
169 * @param bool $prefix
170 *
171 * @return array
172 */
c3fc2621
CW
173 public static function &export($prefix = FALSE) {
174 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'component', $prefix, []);
60808919 175 return $r;
e501603b 176 }
c3fc2621 177
e7a6b91a
AS
178 /**
179 * Returns the list of indices
c3fc2621
CW
180 *
181 * @param bool $localize
182 *
183 * @return array
e7a6b91a
AS
184 */
185 public static function indices($localize = TRUE) {
c3fc2621 186 $indices = [];
e7a6b91a
AS
187 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
188 }
c3fc2621 189
e501603b 190}