Merge pull request #19093 from civicrm/5.32
[civicrm-core.git] / CRM / Core / DAO / Mapping.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/Mapping.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:50a6b7f051df6e61bf9e0b9b930dc861)
10 */
11
12 /**
13 * Database access object for the Mapping entity.
14 */
15 class CRM_Core_DAO_Mapping extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.2';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_mapping';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Mapping ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Name of Mapping
42 *
43 * @var string
44 */
45 public $name;
46
47 /**
48 * Description of Mapping.
49 *
50 * @var string
51 */
52 public $description;
53
54 /**
55 * Mapping Type
56 *
57 * @var int
58 */
59 public $mapping_type_id;
60
61 /**
62 * Class constructor.
63 */
64 public function __construct() {
65 $this->__table = 'civicrm_mapping';
66 parent::__construct();
67 }
68
69 /**
70 * Returns localized title of this entity.
71 *
72 * @param bool $plural
73 * Whether to return the plural version of the title.
74 */
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ? ts('Mappings') : ts('Mapping');
77 }
78
79 /**
80 * Returns all the column names of this table
81 *
82 * @return array
83 */
84 public static function &fields() {
85 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
86 Civi::$statics[__CLASS__]['fields'] = [
87 'id' => [
88 'name' => 'id',
89 'type' => CRM_Utils_Type::T_INT,
90 'title' => ts('Mapping ID'),
91 'description' => ts('Mapping ID'),
92 'required' => TRUE,
93 'where' => 'civicrm_mapping.id',
94 'table_name' => 'civicrm_mapping',
95 'entity' => 'Mapping',
96 'bao' => 'CRM_Core_BAO_Mapping',
97 'localizable' => 0,
98 'add' => '1.2',
99 ],
100 'name' => [
101 'name' => 'name',
102 'type' => CRM_Utils_Type::T_STRING,
103 'title' => ts('Mapping Name'),
104 'description' => ts('Name of Mapping'),
105 'maxlength' => 64,
106 'size' => CRM_Utils_Type::BIG,
107 'where' => 'civicrm_mapping.name',
108 'table_name' => 'civicrm_mapping',
109 'entity' => 'Mapping',
110 'bao' => 'CRM_Core_BAO_Mapping',
111 'localizable' => 0,
112 'add' => '1.2',
113 ],
114 'description' => [
115 'name' => 'description',
116 'type' => CRM_Utils_Type::T_STRING,
117 'title' => ts('Description'),
118 'description' => ts('Description of Mapping.'),
119 'maxlength' => 255,
120 'size' => CRM_Utils_Type::HUGE,
121 'where' => 'civicrm_mapping.description',
122 'table_name' => 'civicrm_mapping',
123 'entity' => 'Mapping',
124 'bao' => 'CRM_Core_BAO_Mapping',
125 'localizable' => 0,
126 'add' => '1.2',
127 ],
128 'mapping_type_id' => [
129 'name' => 'mapping_type_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Mapping Type'),
132 'description' => ts('Mapping Type'),
133 'where' => 'civicrm_mapping.mapping_type_id',
134 'table_name' => 'civicrm_mapping',
135 'entity' => 'Mapping',
136 'bao' => 'CRM_Core_BAO_Mapping',
137 'localizable' => 0,
138 'html' => [
139 'type' => 'Select',
140 ],
141 'pseudoconstant' => [
142 'optionGroupName' => 'mapping_type',
143 'optionEditPath' => 'civicrm/admin/options/mapping_type',
144 ],
145 'add' => '2.1',
146 ],
147 ];
148 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
149 }
150 return Civi::$statics[__CLASS__]['fields'];
151 }
152
153 /**
154 * Return a mapping from field-name to the corresponding key (as used in fields()).
155 *
156 * @return array
157 * Array(string $name => string $uniqueName).
158 */
159 public static function &fieldKeys() {
160 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
161 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
162 }
163 return Civi::$statics[__CLASS__]['fieldKeys'];
164 }
165
166 /**
167 * Returns the names of this table
168 *
169 * @return string
170 */
171 public static function getTableName() {
172 return self::$_tableName;
173 }
174
175 /**
176 * Returns if this table needs to be logged
177 *
178 * @return bool
179 */
180 public function getLog() {
181 return self::$_log;
182 }
183
184 /**
185 * Returns the list of fields that can be imported
186 *
187 * @param bool $prefix
188 *
189 * @return array
190 */
191 public static function &import($prefix = FALSE) {
192 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, []);
193 return $r;
194 }
195
196 /**
197 * Returns the list of fields that can be exported
198 *
199 * @param bool $prefix
200 *
201 * @return array
202 */
203 public static function &export($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, []);
205 return $r;
206 }
207
208 /**
209 * Returns the list of indices
210 *
211 * @param bool $localize
212 *
213 * @return array
214 */
215 public static function indices($localize = TRUE) {
216 $indices = [
217 'UI_name' => [
218 'name' => 'UI_name',
219 'field' => [
220 0 => 'name',
221 ],
222 'localizable' => FALSE,
223 'sig' => 'civicrm_mapping::0::name',
224 ],
225 ];
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
227 }
228
229 }