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