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