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