Merge pull request #22631 from braders/calculateBaseScheduleDate-docblock
[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:a5cc4308aa533a07f2528c5cd3a31896)
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|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * Name of the component.
44 *
45 * @var string
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $name;
50
51 /**
52 * Path to components main directory in a form of a class namespace.
53 *
54 * @var string|null
55 * (SQL type: varchar(128))
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $namespace;
59
60 /**
61 * Class constructor.
62 */
63 public function __construct() {
64 $this->__table = 'civicrm_component';
65 parent::__construct();
66 }
67
68 /**
69 * Returns localized title of this entity.
70 *
71 * @param bool $plural
72 * Whether to return the plural version of the title.
73 */
74 public static function getEntityTitle($plural = FALSE) {
75 return $plural ? ts('Components') : ts('Component');
76 }
77
78 /**
79 * Returns all the column names of this table
80 *
81 * @return array
82 */
83 public static function &fields() {
84 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
85 Civi::$statics[__CLASS__]['fields'] = [
86 'id' => [
87 'name' => 'id',
88 'type' => CRM_Utils_Type::T_INT,
89 'title' => ts('Component ID'),
90 'description' => ts('Component ID'),
91 'required' => TRUE,
92 'where' => 'civicrm_component.id',
93 'table_name' => 'civicrm_component',
94 'entity' => 'Component',
95 'bao' => 'CRM_Core_DAO_Component',
96 'localizable' => 0,
97 'html' => [
98 'type' => 'Number',
99 ],
100 'readonly' => TRUE,
101 'add' => '2.0',
102 ],
103 'name' => [
104 'name' => 'name',
105 'type' => CRM_Utils_Type::T_STRING,
106 'title' => ts('Component name'),
107 'description' => ts('Name of the component.'),
108 'required' => TRUE,
109 'maxlength' => 64,
110 'size' => CRM_Utils_Type::BIG,
111 'where' => 'civicrm_component.name',
112 'table_name' => 'civicrm_component',
113 'entity' => 'Component',
114 'bao' => 'CRM_Core_DAO_Component',
115 'localizable' => 0,
116 'add' => '2.0',
117 ],
118 'namespace' => [
119 'name' => 'namespace',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Namespace reserved for component.'),
122 'description' => ts('Path to components main directory in a form of a class namespace.'),
123 'maxlength' => 128,
124 'size' => CRM_Utils_Type::HUGE,
125 'where' => 'civicrm_component.namespace',
126 'table_name' => 'civicrm_component',
127 'entity' => 'Component',
128 'bao' => 'CRM_Core_DAO_Component',
129 'localizable' => 0,
130 'add' => '2.0',
131 ],
132 ];
133 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
134 }
135 return Civi::$statics[__CLASS__]['fields'];
136 }
137
138 /**
139 * Return a mapping from field-name to the corresponding key (as used in fields()).
140 *
141 * @return array
142 * Array(string $name => string $uniqueName).
143 */
144 public static function &fieldKeys() {
145 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
146 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
147 }
148 return Civi::$statics[__CLASS__]['fieldKeys'];
149 }
150
151 /**
152 * Returns the names of this table
153 *
154 * @return string
155 */
156 public static function getTableName() {
157 return self::$_tableName;
158 }
159
160 /**
161 * Returns if this table needs to be logged
162 *
163 * @return bool
164 */
165 public function getLog() {
166 return self::$_log;
167 }
168
169 /**
170 * Returns the list of fields that can be imported
171 *
172 * @param bool $prefix
173 *
174 * @return array
175 */
176 public static function &import($prefix = FALSE) {
177 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'component', $prefix, []);
178 return $r;
179 }
180
181 /**
182 * Returns the list of fields that can be exported
183 *
184 * @param bool $prefix
185 *
186 * @return array
187 */
188 public static function &export($prefix = FALSE) {
189 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'component', $prefix, []);
190 return $r;
191 }
192
193 /**
194 * Returns the list of indices
195 *
196 * @param bool $localize
197 *
198 * @return array
199 */
200 public static function indices($localize = TRUE) {
201 $indices = [];
202 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
203 }
204
205 }