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