dev/core#3719 fix inconistent handling of job_type:label
[civicrm-core.git] / CRM / Core / DAO / WordReplacement.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/WordReplacement.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c5865289b55e3bdbca5fbca82a61526b)
10 */
11
12 /**
13 * Database access object for the WordReplacement entity.
14 */
15 class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.4';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_word_replacement';
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 * Word replacement 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 * Word which need to be replaced
44 *
45 * @var string|null
46 * (SQL type: varchar(255))
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $find_word;
50
51 /**
52 * Word which will replace the word in find
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 $replace_word;
59
60 /**
61 * Is this entry active?
62 *
63 * @var bool|string
64 * (SQL type: tinyint)
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $is_active;
68
69 /**
70 * @var string|null
71 * (SQL type: varchar(16))
72 * Note that values will be retrieved from the database as a string.
73 */
74 public $match_type;
75
76 /**
77 * FK to Domain ID. This is for Domain specific word replacement
78 *
79 * @var int|string|null
80 * (SQL type: int unsigned)
81 * Note that values will be retrieved from the database as a string.
82 */
83 public $domain_id;
84
85 /**
86 * Class constructor.
87 */
88 public function __construct() {
89 $this->__table = 'civicrm_word_replacement';
90 parent::__construct();
91 }
92
93 /**
94 * Returns localized title of this entity.
95 *
96 * @param bool $plural
97 * Whether to return the plural version of the title.
98 */
99 public static function getEntityTitle($plural = FALSE) {
100 return $plural ? ts('Word Replacements') : ts('Word Replacement');
101 }
102
103 /**
104 * Returns foreign keys and entity references.
105 *
106 * @return array
107 * [CRM_Core_Reference_Interface]
108 */
109 public static function getReferenceColumns() {
110 if (!isset(Civi::$statics[__CLASS__]['links'])) {
111 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
112 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id');
113 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
114 }
115 return Civi::$statics[__CLASS__]['links'];
116 }
117
118 /**
119 * Returns all the column names of this table
120 *
121 * @return array
122 */
123 public static function &fields() {
124 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
125 Civi::$statics[__CLASS__]['fields'] = [
126 'id' => [
127 'name' => 'id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('Word Replacement ID'),
130 'description' => ts('Word replacement ID'),
131 'required' => TRUE,
132 'where' => 'civicrm_word_replacement.id',
133 'table_name' => 'civicrm_word_replacement',
134 'entity' => 'WordReplacement',
135 'bao' => 'CRM_Core_BAO_WordReplacement',
136 'localizable' => 0,
137 'html' => [
138 'type' => 'Number',
139 ],
140 'readonly' => TRUE,
141 'add' => '4.4',
142 ],
143 'find_word' => [
144 'name' => 'find_word',
145 'type' => CRM_Utils_Type::T_STRING,
146 'title' => ts('Replaced Word'),
147 'description' => ts('Word which need to be replaced'),
148 'maxlength' => 255,
149 'size' => CRM_Utils_Type::HUGE,
150 'where' => 'civicrm_word_replacement.find_word',
151 'table_name' => 'civicrm_word_replacement',
152 'entity' => 'WordReplacement',
153 'bao' => 'CRM_Core_BAO_WordReplacement',
154 'localizable' => 0,
155 'add' => '4.4',
156 ],
157 'replace_word' => [
158 'name' => 'replace_word',
159 'type' => CRM_Utils_Type::T_STRING,
160 'title' => ts('Replacement Word'),
161 'description' => ts('Word which will replace the word in find'),
162 'maxlength' => 255,
163 'size' => CRM_Utils_Type::HUGE,
164 'where' => 'civicrm_word_replacement.replace_word',
165 'table_name' => 'civicrm_word_replacement',
166 'entity' => 'WordReplacement',
167 'bao' => 'CRM_Core_BAO_WordReplacement',
168 'localizable' => 0,
169 'add' => '4.4',
170 ],
171 'is_active' => [
172 'name' => 'is_active',
173 'type' => CRM_Utils_Type::T_BOOLEAN,
174 'title' => ts('Word Replacement is Active'),
175 'description' => ts('Is this entry active?'),
176 'required' => TRUE,
177 'where' => 'civicrm_word_replacement.is_active',
178 'default' => '1',
179 'table_name' => 'civicrm_word_replacement',
180 'entity' => 'WordReplacement',
181 'bao' => 'CRM_Core_BAO_WordReplacement',
182 'localizable' => 0,
183 'add' => '4.4',
184 ],
185 'match_type' => [
186 'name' => 'match_type',
187 'type' => CRM_Utils_Type::T_STRING,
188 'title' => ts('Word Replacement Match Type'),
189 'maxlength' => 16,
190 'size' => CRM_Utils_Type::TWELVE,
191 'where' => 'civicrm_word_replacement.match_type',
192 'default' => 'wildcardMatch',
193 'table_name' => 'civicrm_word_replacement',
194 'entity' => 'WordReplacement',
195 'bao' => 'CRM_Core_BAO_WordReplacement',
196 'localizable' => 0,
197 'html' => [
198 'type' => 'Select',
199 ],
200 'pseudoconstant' => [
201 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType',
202 ],
203 'add' => '4.4',
204 ],
205 'domain_id' => [
206 'name' => 'domain_id',
207 'type' => CRM_Utils_Type::T_INT,
208 'title' => ts('Domain ID'),
209 'description' => ts('FK to Domain ID. This is for Domain specific word replacement'),
210 'where' => 'civicrm_word_replacement.domain_id',
211 'table_name' => 'civicrm_word_replacement',
212 'entity' => 'WordReplacement',
213 'bao' => 'CRM_Core_BAO_WordReplacement',
214 'localizable' => 0,
215 'FKClassName' => 'CRM_Core_DAO_Domain',
216 'html' => [
217 'label' => ts("Domain"),
218 ],
219 'pseudoconstant' => [
220 'table' => 'civicrm_domain',
221 'keyColumn' => 'id',
222 'labelColumn' => 'name',
223 ],
224 'add' => '1.1',
225 ],
226 ];
227 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
228 }
229 return Civi::$statics[__CLASS__]['fields'];
230 }
231
232 /**
233 * Return a mapping from field-name to the corresponding key (as used in fields()).
234 *
235 * @return array
236 * Array(string $name => string $uniqueName).
237 */
238 public static function &fieldKeys() {
239 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
240 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
241 }
242 return Civi::$statics[__CLASS__]['fieldKeys'];
243 }
244
245 /**
246 * Returns the names of this table
247 *
248 * @return string
249 */
250 public static function getTableName() {
251 return self::$_tableName;
252 }
253
254 /**
255 * Returns if this table needs to be logged
256 *
257 * @return bool
258 */
259 public function getLog() {
260 return self::$_log;
261 }
262
263 /**
264 * Returns the list of fields that can be imported
265 *
266 * @param bool $prefix
267 *
268 * @return array
269 */
270 public static function &import($prefix = FALSE) {
271 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, []);
272 return $r;
273 }
274
275 /**
276 * Returns the list of fields that can be exported
277 *
278 * @param bool $prefix
279 *
280 * @return array
281 */
282 public static function &export($prefix = FALSE) {
283 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, []);
284 return $r;
285 }
286
287 /**
288 * Returns the list of indices
289 *
290 * @param bool $localize
291 *
292 * @return array
293 */
294 public static function indices($localize = TRUE) {
295 $indices = [
296 'UI_domain_find' => [
297 'name' => 'UI_domain_find',
298 'field' => [
299 0 => 'domain_id',
300 1 => 'find_word',
301 ],
302 'localizable' => FALSE,
303 'unique' => TRUE,
304 'sig' => 'civicrm_word_replacement::1::domain_id::find_word',
305 ],
306 ];
307 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
308 }
309
310 }