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