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