Merge pull request #12639 from aniesshsethh/issue_314
[civicrm-core.git] / CRM / Core / DAO / Component.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Component.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b9121c01e72b5a9a2772dad9274f4549)
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 'title' => ts('Component ID'),
73 'description' => ts('Component ID'),
74 'required' => TRUE,
75 'table_name' => 'civicrm_component',
76 'entity' => 'Component',
77 'bao' => 'CRM_Core_DAO_Component',
78 'localizable' => 0,
79 ],
80 'name' => [
81 'name' => 'name',
82 'type' => CRM_Utils_Type::T_STRING,
83 'title' => ts('Component name'),
84 'description' => ts('Name of the component.'),
85 'required' => TRUE,
86 'maxlength' => 64,
87 'size' => CRM_Utils_Type::BIG,
88 'table_name' => 'civicrm_component',
89 'entity' => 'Component',
90 'bao' => 'CRM_Core_DAO_Component',
91 'localizable' => 0,
92 ],
93 'namespace' => [
94 'name' => 'namespace',
95 'type' => CRM_Utils_Type::T_STRING,
96 'title' => ts('Namespace reserved for component.'),
97 'description' => ts('Path to components main directory in a form of a class
98 namespace.
99 '),
100 'maxlength' => 128,
101 'size' => CRM_Utils_Type::HUGE,
102 'table_name' => 'civicrm_component',
103 'entity' => 'Component',
104 'bao' => 'CRM_Core_DAO_Component',
105 'localizable' => 0,
106 ],
107 ];
108 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
109 }
110 return Civi::$statics[__CLASS__]['fields'];
111 }
112
113 /**
114 * Return a mapping from field-name to the corresponding key (as used in fields()).
115 *
116 * @return array
117 * Array(string $name => string $uniqueName).
118 */
119 public static function &fieldKeys() {
120 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
121 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
122 }
123 return Civi::$statics[__CLASS__]['fieldKeys'];
124 }
125
126 /**
127 * Returns the names of this table
128 *
129 * @return string
130 */
131 public static function getTableName() {
132 return self::$_tableName;
133 }
134
135 /**
136 * Returns if this table needs to be logged
137 *
138 * @return bool
139 */
140 public function getLog() {
141 return self::$_log;
142 }
143
144 /**
145 * Returns the list of fields that can be imported
146 *
147 * @param bool $prefix
148 *
149 * @return array
150 */
151 public static function &import($prefix = FALSE) {
152 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'component', $prefix, []);
153 return $r;
154 }
155
156 /**
157 * Returns the list of fields that can be exported
158 *
159 * @param bool $prefix
160 *
161 * @return array
162 */
163 public static function &export($prefix = FALSE) {
164 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'component', $prefix, []);
165 return $r;
166 }
167
168 /**
169 * Returns the list of indices
170 *
171 * @param bool $localize
172 *
173 * @return array
174 */
175 public static function indices($localize = TRUE) {
176 $indices = [];
177 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
178 }
179
180 }