Merge pull request #23213 from eileenmcnaughton/post
[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
28979d65 9 * (GenCodeChecksum:c69c9d834bfaaf44088ae0cd11e36b5f)
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 *
28979d65
CW
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
e501603b
TO
39 */
40 public $id;
c3fc2621 41
e501603b
TO
42 /**
43 * Name of Mapping
44 *
28979d65
CW
45 * @var string|null
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
e501603b
TO
48 */
49 public $name;
c3fc2621 50
e501603b
TO
51 /**
52 * Description of Mapping.
53 *
28979d65
CW
54 * @var string|null
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
e501603b
TO
57 */
58 public $description;
c3fc2621 59
e501603b
TO
60 /**
61 * Mapping Type
62 *
28979d65
CW
63 * @var int|string|null
64 * (SQL type: int unsigned)
65 * Note that values will be retrieved from the database as a string.
e501603b
TO
66 */
67 public $mapping_type_id;
c3fc2621 68
e501603b 69 /**
f41f0342 70 * Class constructor.
e501603b 71 */
c3fc2621 72 public function __construct() {
e501603b
TO
73 $this->__table = 'civicrm_mapping';
74 parent::__construct();
75 }
c3fc2621 76
449c4e6b
CW
77 /**
78 * Returns localized title of this entity.
7b66c3b5
AH
79 *
80 * @param bool $plural
81 * Whether to return the plural version of the title.
449c4e6b 82 */
7b66c3b5
AH
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ? ts('Mappings') : ts('Mapping');
449c4e6b
CW
85 }
86
e501603b
TO
87 /**
88 * Returns all the column names of this table
89 *
90 * @return array
91 */
c3fc2621 92 public static function &fields() {
346aaaba 93 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
94 Civi::$statics[__CLASS__]['fields'] = [
95 'id' => [
e501603b
TO
96 'name' => 'id',
97 'type' => CRM_Utils_Type::T_INT,
c3fc2621 98 'title' => ts('Mapping ID'),
215b423e 99 'description' => ts('Mapping ID'),
c3fc2621 100 'required' => TRUE,
a36434b9 101 'where' => 'civicrm_mapping.id',
522a26c9 102 'table_name' => 'civicrm_mapping',
103 'entity' => 'Mapping',
104 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 105 'localizable' => 0,
2cbbebe8
A
106 'html' => [
107 'type' => 'Number',
108 ],
1fe423d6 109 'readonly' => TRUE,
a9d0587b 110 'add' => '1.2',
c3fc2621
CW
111 ],
112 'name' => [
e501603b
TO
113 'name' => 'name',
114 'type' => CRM_Utils_Type::T_STRING,
110684e4 115 'title' => ts('Mapping Name'),
215b423e 116 'description' => ts('Name of Mapping'),
e501603b
TO
117 'maxlength' => 64,
118 'size' => CRM_Utils_Type::BIG,
a36434b9 119 'where' => 'civicrm_mapping.name',
522a26c9 120 'table_name' => 'civicrm_mapping',
121 'entity' => 'Mapping',
122 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 123 'localizable' => 0,
a9d0587b 124 'add' => '1.2',
c3fc2621
CW
125 ],
126 'description' => [
e501603b
TO
127 'name' => 'description',
128 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 129 'title' => ts('Description'),
215b423e 130 'description' => ts('Description of Mapping.'),
e501603b
TO
131 'maxlength' => 255,
132 'size' => CRM_Utils_Type::HUGE,
a36434b9 133 'where' => 'civicrm_mapping.description',
522a26c9 134 'table_name' => 'civicrm_mapping',
135 'entity' => 'Mapping',
136 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 137 'localizable' => 0,
a9d0587b 138 'add' => '1.2',
c3fc2621
CW
139 ],
140 'mapping_type_id' => [
e501603b
TO
141 'name' => 'mapping_type_id',
142 'type' => CRM_Utils_Type::T_INT,
c3fc2621 143 'title' => ts('Mapping Type'),
215b423e 144 'description' => ts('Mapping Type'),
a36434b9 145 'where' => 'civicrm_mapping.mapping_type_id',
522a26c9 146 'table_name' => 'civicrm_mapping',
147 'entity' => 'Mapping',
148 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 149 'localizable' => 0,
c3fc2621 150 'html' => [
e501603b 151 'type' => 'Select',
c3fc2621
CW
152 ],
153 'pseudoconstant' => [
e501603b
TO
154 'optionGroupName' => 'mapping_type',
155 'optionEditPath' => 'civicrm/admin/options/mapping_type',
e6ca0a57 156 ],
a9d0587b 157 'add' => '2.1',
c3fc2621
CW
158 ],
159 ];
346aaaba 160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 161 }
346aaaba 162 return Civi::$statics[__CLASS__]['fields'];
e501603b 163 }
c3fc2621 164
e501603b 165 /**
bd8e0b14 166 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
167 *
168 * @return array
bd8e0b14 169 * Array(string $name => string $uniqueName).
e501603b 170 */
c3fc2621 171 public static function &fieldKeys() {
bd8e0b14
TO
172 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
173 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 174 }
bd8e0b14 175 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 176 }
c3fc2621 177
e501603b
TO
178 /**
179 * Returns the names of this table
180 *
181 * @return string
182 */
c3fc2621 183 public static function getTableName() {
e501603b
TO
184 return self::$_tableName;
185 }
c3fc2621 186
e501603b
TO
187 /**
188 * Returns if this table needs to be logged
189 *
c3fc2621 190 * @return bool
e501603b 191 */
c3fc2621 192 public function getLog() {
e501603b
TO
193 return self::$_log;
194 }
c3fc2621 195
e501603b
TO
196 /**
197 * Returns the list of fields that can be imported
198 *
199 * @param bool $prefix
200 *
201 * @return array
202 */
c3fc2621
CW
203 public static function &import($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, []);
60808919 205 return $r;
e501603b 206 }
c3fc2621 207
e501603b
TO
208 /**
209 * Returns the list of fields that can be exported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
c3fc2621
CW
215 public static function &export($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, []);
60808919 217 return $r;
e501603b 218 }
c3fc2621 219
e7a6b91a
AS
220 /**
221 * Returns the list of indices
c3fc2621
CW
222 *
223 * @param bool $localize
224 *
225 * @return array
e7a6b91a
AS
226 */
227 public static function indices($localize = TRUE) {
c3fc2621
CW
228 $indices = [
229 'UI_name' => [
e7a6b91a 230 'name' => 'UI_name',
c3fc2621 231 'field' => [
e7a6b91a 232 0 => 'name',
c3fc2621
CW
233 ],
234 'localizable' => FALSE,
e7a6b91a 235 'sig' => 'civicrm_mapping::0::name',
c3fc2621
CW
236 ],
237 ];
e7a6b91a
AS
238 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
239 }
c3fc2621 240
e501603b 241}