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