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