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