Merge pull request #12344 from jitendrapurohit/core-192
[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 */
22 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 */
c3fc2621
CW
29 static $_log = FALSE;
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,
522a26c9 81 'table_name' => 'civicrm_mapping',
82 'entity' => 'Mapping',
83 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 84 'localizable' => 0,
c3fc2621
CW
85 ],
86 'name' => [
e501603b
TO
87 'name' => 'name',
88 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 89 'title' => ts('Name'),
215b423e 90 'description' => ts('Name of Mapping'),
e501603b
TO
91 'maxlength' => 64,
92 'size' => CRM_Utils_Type::BIG,
522a26c9 93 'table_name' => 'civicrm_mapping',
94 'entity' => 'Mapping',
95 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 96 'localizable' => 0,
c3fc2621
CW
97 ],
98 'description' => [
e501603b
TO
99 'name' => 'description',
100 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 101 'title' => ts('Description'),
215b423e 102 'description' => ts('Description of Mapping.'),
e501603b
TO
103 'maxlength' => 255,
104 'size' => CRM_Utils_Type::HUGE,
522a26c9 105 'table_name' => 'civicrm_mapping',
106 'entity' => 'Mapping',
107 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 108 'localizable' => 0,
c3fc2621
CW
109 ],
110 'mapping_type_id' => [
e501603b
TO
111 'name' => 'mapping_type_id',
112 'type' => CRM_Utils_Type::T_INT,
c3fc2621 113 'title' => ts('Mapping Type'),
215b423e 114 'description' => ts('Mapping Type'),
522a26c9 115 'table_name' => 'civicrm_mapping',
116 'entity' => 'Mapping',
117 'bao' => 'CRM_Core_BAO_Mapping',
6a7e5e5d 118 'localizable' => 0,
c3fc2621 119 'html' => [
e501603b 120 'type' => 'Select',
c3fc2621
CW
121 ],
122 'pseudoconstant' => [
e501603b
TO
123 'optionGroupName' => 'mapping_type',
124 'optionEditPath' => 'civicrm/admin/options/mapping_type',
c3fc2621
CW
125 ]
126 ],
127 ];
346aaaba 128 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 129 }
346aaaba 130 return Civi::$statics[__CLASS__]['fields'];
e501603b 131 }
c3fc2621 132
e501603b 133 /**
bd8e0b14 134 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
135 *
136 * @return array
bd8e0b14 137 * Array(string $name => string $uniqueName).
e501603b 138 */
c3fc2621 139 public static function &fieldKeys() {
bd8e0b14
TO
140 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
141 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 142 }
bd8e0b14 143 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 144 }
c3fc2621 145
e501603b
TO
146 /**
147 * Returns the names of this table
148 *
149 * @return string
150 */
c3fc2621 151 public static function getTableName() {
e501603b
TO
152 return self::$_tableName;
153 }
c3fc2621 154
e501603b
TO
155 /**
156 * Returns if this table needs to be logged
157 *
c3fc2621 158 * @return bool
e501603b 159 */
c3fc2621 160 public function getLog() {
e501603b
TO
161 return self::$_log;
162 }
c3fc2621 163
e501603b
TO
164 /**
165 * Returns the list of fields that can be imported
166 *
167 * @param bool $prefix
168 *
169 * @return array
170 */
c3fc2621
CW
171 public static function &import($prefix = FALSE) {
172 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mapping', $prefix, []);
60808919 173 return $r;
e501603b 174 }
c3fc2621 175
e501603b
TO
176 /**
177 * Returns the list of fields that can be exported
178 *
179 * @param bool $prefix
180 *
181 * @return array
182 */
c3fc2621
CW
183 public static function &export($prefix = FALSE) {
184 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mapping', $prefix, []);
60808919 185 return $r;
e501603b 186 }
c3fc2621 187
e7a6b91a
AS
188 /**
189 * Returns the list of indices
c3fc2621
CW
190 *
191 * @param bool $localize
192 *
193 * @return array
e7a6b91a
AS
194 */
195 public static function indices($localize = TRUE) {
c3fc2621
CW
196 $indices = [
197 'UI_name' => [
e7a6b91a 198 'name' => 'UI_name',
c3fc2621 199 'field' => [
e7a6b91a 200 0 => 'name',
c3fc2621
CW
201 ],
202 'localizable' => FALSE,
e7a6b91a 203 'sig' => 'civicrm_mapping::0::name',
c3fc2621
CW
204 ],
205 ];
e7a6b91a
AS
206 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
207 }
c3fc2621 208
e501603b 209}