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 | |
7b66c3b5 | 9 | * (GenCodeChecksum:104090c38770547ffa491fccdf299765) |
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 { |
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, |
a9d0587b | 125 | 'add' => '4.4', |
c3fc2621 CW |
126 | ], |
127 | 'find_word' => [ | |
e501603b TO |
128 | 'name' => 'find_word', |
129 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 130 | 'title' => ts('Replaced Word'), |
215b423e | 131 | 'description' => ts('Word which need to be replaced'), |
e501603b TO |
132 | 'maxlength' => 255, |
133 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 134 | 'where' => 'civicrm_word_replacement.find_word', |
522a26c9 | 135 | 'table_name' => 'civicrm_word_replacement', |
136 | 'entity' => 'WordReplacement', | |
137 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 138 | 'localizable' => 0, |
a9d0587b | 139 | 'add' => '4.4', |
c3fc2621 CW |
140 | ], |
141 | 'replace_word' => [ | |
e501603b TO |
142 | 'name' => 'replace_word', |
143 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 144 | 'title' => ts('Replacement Word'), |
215b423e | 145 | 'description' => ts('Word which will replace the word in find'), |
e501603b TO |
146 | 'maxlength' => 255, |
147 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 148 | 'where' => 'civicrm_word_replacement.replace_word', |
522a26c9 | 149 | 'table_name' => 'civicrm_word_replacement', |
150 | 'entity' => 'WordReplacement', | |
151 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 152 | 'localizable' => 0, |
a9d0587b | 153 | 'add' => '4.4', |
c3fc2621 CW |
154 | ], |
155 | 'is_active' => [ | |
e501603b TO |
156 | 'name' => 'is_active', |
157 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 158 | 'title' => ts('Word Replacement is Active'), |
215b423e | 159 | 'description' => ts('Is this entry active?'), |
a36434b9 | 160 | 'where' => 'civicrm_word_replacement.is_active', |
e501603b | 161 | 'default' => '1', |
522a26c9 | 162 | 'table_name' => 'civicrm_word_replacement', |
163 | 'entity' => 'WordReplacement', | |
164 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 165 | 'localizable' => 0, |
a9d0587b | 166 | 'add' => '4.4', |
c3fc2621 CW |
167 | ], |
168 | 'match_type' => [ | |
e501603b TO |
169 | 'name' => 'match_type', |
170 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 171 | 'title' => ts('Word Replacement Match Type'), |
e501603b TO |
172 | 'maxlength' => 16, |
173 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 174 | 'where' => 'civicrm_word_replacement.match_type', |
e501603b | 175 | 'default' => 'wildcardMatch', |
522a26c9 | 176 | 'table_name' => 'civicrm_word_replacement', |
177 | 'entity' => 'WordReplacement', | |
178 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 179 | 'localizable' => 0, |
c3fc2621 | 180 | 'html' => [ |
e501603b | 181 | 'type' => 'Select', |
c3fc2621 CW |
182 | ], |
183 | 'pseudoconstant' => [ | |
e501603b | 184 | 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType', |
e6ca0a57 | 185 | ], |
a9d0587b | 186 | 'add' => '4.4', |
c3fc2621 CW |
187 | ], |
188 | 'domain_id' => [ | |
e501603b TO |
189 | 'name' => 'domain_id', |
190 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 191 | 'title' => ts('Word Replacement Domain ID'), |
215b423e | 192 | 'description' => ts('FK to Domain ID. This is for Domain specific word replacement'), |
a36434b9 | 193 | 'where' => 'civicrm_word_replacement.domain_id', |
522a26c9 | 194 | 'table_name' => 'civicrm_word_replacement', |
195 | 'entity' => 'WordReplacement', | |
196 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 197 | 'localizable' => 0, |
e501603b | 198 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 199 | 'pseudoconstant' => [ |
e501603b TO |
200 | 'table' => 'civicrm_domain', |
201 | 'keyColumn' => 'id', | |
202 | 'labelColumn' => 'name', | |
e6ca0a57 | 203 | ], |
a9d0587b | 204 | 'add' => '1.1', |
c3fc2621 CW |
205 | ], |
206 | ]; | |
346aaaba | 207 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 208 | } |
346aaaba | 209 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 210 | } |
c3fc2621 | 211 | |
e501603b | 212 | /** |
bd8e0b14 | 213 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
214 | * |
215 | * @return array | |
bd8e0b14 | 216 | * Array(string $name => string $uniqueName). |
e501603b | 217 | */ |
c3fc2621 | 218 | public static function &fieldKeys() { |
bd8e0b14 TO |
219 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
220 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 221 | } |
bd8e0b14 | 222 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 223 | } |
c3fc2621 | 224 | |
e501603b TO |
225 | /** |
226 | * Returns the names of this table | |
227 | * | |
228 | * @return string | |
229 | */ | |
c3fc2621 | 230 | public static function getTableName() { |
e501603b TO |
231 | return self::$_tableName; |
232 | } | |
c3fc2621 | 233 | |
e501603b TO |
234 | /** |
235 | * Returns if this table needs to be logged | |
236 | * | |
c3fc2621 | 237 | * @return bool |
e501603b | 238 | */ |
c3fc2621 | 239 | public function getLog() { |
e501603b TO |
240 | return self::$_log; |
241 | } | |
c3fc2621 | 242 | |
e501603b TO |
243 | /** |
244 | * Returns the list of fields that can be imported | |
245 | * | |
246 | * @param bool $prefix | |
247 | * | |
248 | * @return array | |
249 | */ | |
c3fc2621 CW |
250 | public static function &import($prefix = FALSE) { |
251 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, []); | |
60808919 | 252 | return $r; |
e501603b | 253 | } |
c3fc2621 | 254 | |
e501603b TO |
255 | /** |
256 | * Returns the list of fields that can be exported | |
257 | * | |
258 | * @param bool $prefix | |
259 | * | |
260 | * @return array | |
261 | */ | |
c3fc2621 CW |
262 | public static function &export($prefix = FALSE) { |
263 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, []); | |
60808919 | 264 | return $r; |
e501603b | 265 | } |
c3fc2621 | 266 | |
e7a6b91a AS |
267 | /** |
268 | * Returns the list of indices | |
c3fc2621 CW |
269 | * |
270 | * @param bool $localize | |
271 | * | |
272 | * @return array | |
e7a6b91a AS |
273 | */ |
274 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
275 | $indices = [ |
276 | 'UI_domain_find' => [ | |
e7a6b91a | 277 | 'name' => 'UI_domain_find', |
c3fc2621 | 278 | 'field' => [ |
e7a6b91a AS |
279 | 0 => 'domain_id', |
280 | 1 => 'find_word', | |
c3fc2621 CW |
281 | ], |
282 | 'localizable' => FALSE, | |
283 | 'unique' => TRUE, | |
e7a6b91a | 284 | 'sig' => 'civicrm_word_replacement::1::domain_id::find_word', |
c3fc2621 CW |
285 | ], |
286 | ]; | |
e7a6b91a AS |
287 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
288 | } | |
c3fc2621 | 289 | |
e501603b | 290 | } |