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