Merge pull request #14014 from MegaphoneJon/reporting-14
[civicrm-core.git] / CRM / Core / DAO / Mapping.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/Mapping.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:26d8aa33c9340571c606aa5b8f085c1a)
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 {
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_mapping';
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 * Mapping ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Name of Mapping
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b
TO
45 /**
46 * Description of Mapping.
47 *
48 * @var string
49 */
50 public $description;
c3fc2621 51
e501603b
TO
52 /**
53 * Mapping Type
54 *
55 * @var int unsigned
56 */
57 public $mapping_type_id;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_mapping';
64 parent::__construct();
65 }
c3fc2621 66
e501603b
TO
67 /**
68 * Returns all the column names of this table
69 *
70 * @return array
71 */
c3fc2621 72 public static function &fields() {
346aaaba 73 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
74 Civi::$statics[__CLASS__]['fields'] = [
75 'id' => [
e501603b
TO
76 'name' => 'id',
77 'type' => CRM_Utils_Type::T_INT,
c3fc2621 78 'title' => ts('Mapping ID'),
215b423e 79 'description' => ts('Mapping ID'),
c3fc2621 80 'required' => TRUE,
a36434b9 81 'where' => 'civicrm_mapping.id',
522a26c9 82 'table_name' => 'civicrm_mapping',
83 'entity' => 'Mapping',
84 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 85 'localizable' => 0,
c3fc2621
CW
86 ],
87 'name' => [
e501603b
TO
88 'name' => 'name',
89 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 90 'title' => ts('Name'),
215b423e 91 'description' => ts('Name of Mapping'),
e501603b
TO
92 'maxlength' => 64,
93 'size' => CRM_Utils_Type::BIG,
a36434b9 94 'where' => 'civicrm_mapping.name',
522a26c9 95 'table_name' => 'civicrm_mapping',
96 'entity' => 'Mapping',
97 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 98 'localizable' => 0,
c3fc2621
CW
99 ],
100 'description' => [
e501603b
TO
101 'name' => 'description',
102 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 103 'title' => ts('Description'),
215b423e 104 'description' => ts('Description of Mapping.'),
e501603b
TO
105 'maxlength' => 255,
106 'size' => CRM_Utils_Type::HUGE,
a36434b9 107 'where' => 'civicrm_mapping.description',
522a26c9 108 'table_name' => 'civicrm_mapping',
109 'entity' => 'Mapping',
110 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 111 'localizable' => 0,
c3fc2621
CW
112 ],
113 'mapping_type_id' => [
e501603b
TO
114 'name' => 'mapping_type_id',
115 'type' => CRM_Utils_Type::T_INT,
c3fc2621 116 'title' => ts('Mapping Type'),
215b423e 117 'description' => ts('Mapping Type'),
a36434b9 118 'where' => 'civicrm_mapping.mapping_type_id',
522a26c9 119 'table_name' => 'civicrm_mapping',
120 'entity' => 'Mapping',
121 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 122 'localizable' => 0,
c3fc2621 123 'html' => [
e501603b 124 'type' => 'Select',
c3fc2621
CW
125 ],
126 'pseudoconstant' => [
e501603b
TO
127 'optionGroupName' => 'mapping_type',
128 'optionEditPath' => 'civicrm/admin/options/mapping_type',
c3fc2621
CW
129 ]
130 ],
131 ];
346aaaba 132 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 133 }
346aaaba 134 return Civi::$statics[__CLASS__]['fields'];
e501603b 135 }
c3fc2621 136
e501603b 137 /**
bd8e0b14 138 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
139 *
140 * @return array
bd8e0b14 141 * Array(string $name => string $uniqueName).
e501603b 142 */
c3fc2621 143 public static function &fieldKeys() {
bd8e0b14
TO
144 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
145 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 146 }
bd8e0b14 147 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 148 }
c3fc2621 149
e501603b
TO
150 /**
151 * Returns the names of this table
152 *
153 * @return string
154 */
c3fc2621 155 public static function getTableName() {
e501603b
TO
156 return self::$_tableName;
157 }
c3fc2621 158
e501603b
TO
159 /**
160 * Returns if this table needs to be logged
161 *
c3fc2621 162 * @return bool
e501603b 163 */
c3fc2621 164 public function getLog() {
e501603b
TO
165 return self::$_log;
166 }
c3fc2621 167
e501603b
TO
168 /**
169 * Returns the list of fields that can be imported
170 *
171 * @param bool $prefix
172 *
173 * @return array
174 */
c3fc2621
CW
175 public static function &import($prefix = FALSE) {
176 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, []);
60808919 177 return $r;
e501603b 178 }
c3fc2621 179
e501603b
TO
180 /**
181 * Returns the list of fields that can be exported
182 *
183 * @param bool $prefix
184 *
185 * @return array
186 */
c3fc2621
CW
187 public static function &export($prefix = FALSE) {
188 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, []);
60808919 189 return $r;
e501603b 190 }
c3fc2621 191
e7a6b91a
AS
192 /**
193 * Returns the list of indices
c3fc2621
CW
194 *
195 * @param bool $localize
196 *
197 * @return array
e7a6b91a
AS
198 */
199 public static function indices($localize = TRUE) {
c3fc2621
CW
200 $indices = [
201 'UI_name' => [
e7a6b91a 202 'name' => 'UI_name',
c3fc2621 203 'field' => [
e7a6b91a 204 0 => 'name',
c3fc2621
CW
205 ],
206 'localizable' => FALSE,
e7a6b91a 207 'sig' => 'civicrm_mapping::0::name',
c3fc2621
CW
208 ],
209 ];
e7a6b91a
AS
210 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
211 }
c3fc2621 212
e501603b 213}