Merge pull request #22155 from eileenmcnaughton/n4
[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:4a0976e14e588b9a81c79e72849494e0)
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 'html' => [
99 'type' => 'Number',
100 ],
101 'readonly' => TRUE,
102 'add' => '1.2',
103 ],
104 'name' => [
105 'name' => 'name',
106 'type' => CRM_Utils_Type::T_STRING,
107 'title' => ts('Mapping Name'),
108 'description' => ts('Name of Mapping'),
109 'maxlength' => 64,
110 'size' => CRM_Utils_Type::BIG,
111 'where' => 'civicrm_mapping.name',
112 'table_name' => 'civicrm_mapping',
113 'entity' => 'Mapping',
114 'bao' => 'CRM_Core_BAO_Mapping',
115 'localizable' => 0,
116 'add' => '1.2',
117 ],
118 'description' => [
119 'name' => 'description',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Description'),
122 'description' => ts('Description of Mapping.'),
123 'maxlength' => 255,
124 'size' => CRM_Utils_Type::HUGE,
125 'where' => 'civicrm_mapping.description',
126 'table_name' => 'civicrm_mapping',
127 'entity' => 'Mapping',
128 'bao' => 'CRM_Core_BAO_Mapping',
129 'localizable' => 0,
130 'add' => '1.2',
131 ],
132 'mapping_type_id' => [
133 'name' => 'mapping_type_id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('Mapping Type'),
136 'description' => ts('Mapping Type'),
137 'where' => 'civicrm_mapping.mapping_type_id',
138 'table_name' => 'civicrm_mapping',
139 'entity' => 'Mapping',
140 'bao' => 'CRM_Core_BAO_Mapping',
141 'localizable' => 0,
142 'html' => [
143 'type' => 'Select',
144 ],
145 'pseudoconstant' => [
146 'optionGroupName' => 'mapping_type',
147 'optionEditPath' => 'civicrm/admin/options/mapping_type',
148 ],
149 'add' => '2.1',
150 ],
151 ];
152 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
153 }
154 return Civi::$statics[__CLASS__]['fields'];
155 }
156
157 /**
158 * Return a mapping from field-name to the corresponding key (as used in fields()).
159 *
160 * @return array
161 * Array(string $name => string $uniqueName).
162 */
163 public static function &fieldKeys() {
164 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
165 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
166 }
167 return Civi::$statics[__CLASS__]['fieldKeys'];
168 }
169
170 /**
171 * Returns the names of this table
172 *
173 * @return string
174 */
175 public static function getTableName() {
176 return self::$_tableName;
177 }
178
179 /**
180 * Returns if this table needs to be logged
181 *
182 * @return bool
183 */
184 public function getLog() {
185 return self::$_log;
186 }
187
188 /**
189 * Returns the list of fields that can be imported
190 *
191 * @param bool $prefix
192 *
193 * @return array
194 */
195 public static function &import($prefix = FALSE) {
196 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, []);
197 return $r;
198 }
199
200 /**
201 * Returns the list of fields that can be exported
202 *
203 * @param bool $prefix
204 *
205 * @return array
206 */
207 public static function &export($prefix = FALSE) {
208 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, []);
209 return $r;
210 }
211
212 /**
213 * Returns the list of indices
214 *
215 * @param bool $localize
216 *
217 * @return array
218 */
219 public static function indices($localize = TRUE) {
220 $indices = [
221 'UI_name' => [
222 'name' => 'UI_name',
223 'field' => [
224 0 => 'name',
225 ],
226 'localizable' => FALSE,
227 'sig' => 'civicrm_mapping::0::name',
228 ],
229 ];
230 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
231 }
232
233 }