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