Set version to 5.28.alpha1
[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:7df1b2e6e35d3bbd5ae6d71f559cf8cb)
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 all the column names of this table
62 *
63 * @return array
64 */
65 public static function &fields() {
66 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
67 Civi::$statics[__CLASS__]['fields'] = [
68 'id' => [
69 'name' => 'id',
70 'type' => CRM_Utils_Type::T_INT,
71 'title' => ts('Component ID'),
72 'description' => ts('Component ID'),
73 'required' => TRUE,
74 'where' => 'civicrm_component.id',
75 'table_name' => 'civicrm_component',
76 'entity' => 'Component',
77 'bao' => 'CRM_Core_DAO_Component',
78 'localizable' => 0,
79 ],
80 'name' => [
81 'name' => 'name',
82 'type' => CRM_Utils_Type::T_STRING,
83 'title' => ts('Component name'),
84 'description' => ts('Name of the component.'),
85 'required' => TRUE,
86 'maxlength' => 64,
87 'size' => CRM_Utils_Type::BIG,
88 'where' => 'civicrm_component.name',
89 'table_name' => 'civicrm_component',
90 'entity' => 'Component',
91 'bao' => 'CRM_Core_DAO_Component',
92 'localizable' => 0,
93 ],
94 'namespace' => [
95 'name' => 'namespace',
96 'type' => CRM_Utils_Type::T_STRING,
97 'title' => ts('Namespace reserved for component.'),
98 'description' => ts('Path to components main directory in a form of a class namespace.'),
99 'maxlength' => 128,
100 'size' => CRM_Utils_Type::HUGE,
101 'where' => 'civicrm_component.namespace',
102 'table_name' => 'civicrm_component',
103 'entity' => 'Component',
104 'bao' => 'CRM_Core_DAO_Component',
105 'localizable' => 0,
106 ],
107 ];
108 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
109 }
110 return Civi::$statics[__CLASS__]['fields'];
111 }
112
113 /**
114 * Return a mapping from field-name to the corresponding key (as used in fields()).
115 *
116 * @return array
117 * Array(string $name => string $uniqueName).
118 */
119 public static function &fieldKeys() {
120 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
121 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
122 }
123 return Civi::$statics[__CLASS__]['fieldKeys'];
124 }
125
126 /**
127 * Returns the names of this table
128 *
129 * @return string
130 */
131 public static function getTableName() {
132 return self::$_tableName;
133 }
134
135 /**
136 * Returns if this table needs to be logged
137 *
138 * @return bool
139 */
140 public function getLog() {
141 return self::$_log;
142 }
143
144 /**
145 * Returns the list of fields that can be imported
146 *
147 * @param bool $prefix
148 *
149 * @return array
150 */
151 public static function &import($prefix = FALSE) {
152 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'component', $prefix, []);
153 return $r;
154 }
155
156 /**
157 * Returns the list of fields that can be exported
158 *
159 * @param bool $prefix
160 *
161 * @return array
162 */
163 public static function &export($prefix = FALSE) {
164 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'component', $prefix, []);
165 return $r;
166 }
167
168 /**
169 * Returns the list of indices
170 *
171 * @param bool $localize
172 *
173 * @return array
174 */
175 public static function indices($localize = TRUE) {
176 $indices = [];
177 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
178 }
179
180 }