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