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