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