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