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