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 | |
f29bf4f3 | 9 | * (GenCodeChecksum:0e956a44911169933aabb2bfdc266e32) |
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 | |
e501603b | 79 | /** |
f41f0342 | 80 | * Returns foreign keys and entity references. |
e501603b TO |
81 | * |
82 | * @return array | |
83 | * [CRM_Core_Reference_Interface] | |
84 | */ | |
c3fc2621 | 85 | public static function getReferenceColumns() { |
346aaaba | 86 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 87 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 | 88 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'domain_id', 'civicrm_domain', 'id'); |
346aaaba | 89 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 90 | } |
346aaaba | 91 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 92 | } |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Returns all the column names of this table | |
96 | * | |
97 | * @return array | |
98 | */ | |
c3fc2621 | 99 | public static function &fields() { |
346aaaba | 100 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
101 | Civi::$statics[__CLASS__]['fields'] = [ |
102 | 'id' => [ | |
e501603b TO |
103 | 'name' => 'id', |
104 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 105 | 'title' => ts('Word Replacement ID'), |
215b423e | 106 | 'description' => ts('Word replacement ID'), |
c3fc2621 | 107 | 'required' => TRUE, |
a36434b9 | 108 | 'where' => 'civicrm_word_replacement.id', |
522a26c9 | 109 | 'table_name' => 'civicrm_word_replacement', |
110 | 'entity' => 'WordReplacement', | |
111 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 112 | 'localizable' => 0, |
c3fc2621 CW |
113 | ], |
114 | 'find_word' => [ | |
e501603b TO |
115 | 'name' => 'find_word', |
116 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 117 | 'title' => ts('Replaced Word'), |
215b423e | 118 | 'description' => ts('Word which need to be replaced'), |
e501603b TO |
119 | 'maxlength' => 255, |
120 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 121 | 'where' => 'civicrm_word_replacement.find_word', |
522a26c9 | 122 | 'table_name' => 'civicrm_word_replacement', |
123 | 'entity' => 'WordReplacement', | |
124 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 125 | 'localizable' => 0, |
c3fc2621 CW |
126 | ], |
127 | 'replace_word' => [ | |
e501603b TO |
128 | 'name' => 'replace_word', |
129 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 130 | 'title' => ts('Replacement Word'), |
215b423e | 131 | 'description' => ts('Word which will replace the word in find'), |
e501603b TO |
132 | 'maxlength' => 255, |
133 | 'size' => CRM_Utils_Type::HUGE, | |
a36434b9 | 134 | 'where' => 'civicrm_word_replacement.replace_word', |
522a26c9 | 135 | 'table_name' => 'civicrm_word_replacement', |
136 | 'entity' => 'WordReplacement', | |
137 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 138 | 'localizable' => 0, |
c3fc2621 CW |
139 | ], |
140 | 'is_active' => [ | |
e501603b TO |
141 | 'name' => 'is_active', |
142 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 143 | 'title' => ts('Word Replacement is Active'), |
215b423e | 144 | 'description' => ts('Is this entry active?'), |
a36434b9 | 145 | 'where' => 'civicrm_word_replacement.is_active', |
e501603b | 146 | 'default' => '1', |
522a26c9 | 147 | 'table_name' => 'civicrm_word_replacement', |
148 | 'entity' => 'WordReplacement', | |
149 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 150 | 'localizable' => 0, |
c3fc2621 CW |
151 | ], |
152 | 'match_type' => [ | |
e501603b TO |
153 | 'name' => 'match_type', |
154 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 155 | 'title' => ts('Word Replacement Match Type'), |
e501603b TO |
156 | 'maxlength' => 16, |
157 | 'size' => CRM_Utils_Type::TWELVE, | |
a36434b9 | 158 | 'where' => 'civicrm_word_replacement.match_type', |
e501603b | 159 | 'default' => 'wildcardMatch', |
522a26c9 | 160 | 'table_name' => 'civicrm_word_replacement', |
161 | 'entity' => 'WordReplacement', | |
162 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 163 | 'localizable' => 0, |
c3fc2621 | 164 | 'html' => [ |
e501603b | 165 | 'type' => 'Select', |
c3fc2621 CW |
166 | ], |
167 | 'pseudoconstant' => [ | |
e501603b | 168 | 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType', |
e6ca0a57 | 169 | ], |
c3fc2621 CW |
170 | ], |
171 | 'domain_id' => [ | |
e501603b TO |
172 | 'name' => 'domain_id', |
173 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 174 | 'title' => ts('Word Replacement Domain ID'), |
215b423e | 175 | 'description' => ts('FK to Domain ID. This is for Domain specific word replacement'), |
a36434b9 | 176 | 'where' => 'civicrm_word_replacement.domain_id', |
522a26c9 | 177 | 'table_name' => 'civicrm_word_replacement', |
178 | 'entity' => 'WordReplacement', | |
179 | 'bao' => 'CRM_Core_BAO_WordReplacement', | |
6a7e5e5d | 180 | 'localizable' => 0, |
e501603b | 181 | 'FKClassName' => 'CRM_Core_DAO_Domain', |
c3fc2621 | 182 | 'pseudoconstant' => [ |
e501603b TO |
183 | 'table' => 'civicrm_domain', |
184 | 'keyColumn' => 'id', | |
185 | 'labelColumn' => 'name', | |
e6ca0a57 | 186 | ], |
c3fc2621 CW |
187 | ], |
188 | ]; | |
346aaaba | 189 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 190 | } |
346aaaba | 191 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 192 | } |
c3fc2621 | 193 | |
e501603b | 194 | /** |
bd8e0b14 | 195 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
196 | * |
197 | * @return array | |
bd8e0b14 | 198 | * Array(string $name => string $uniqueName). |
e501603b | 199 | */ |
c3fc2621 | 200 | public static function &fieldKeys() { |
bd8e0b14 TO |
201 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
202 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 203 | } |
bd8e0b14 | 204 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 205 | } |
c3fc2621 | 206 | |
e501603b TO |
207 | /** |
208 | * Returns the names of this table | |
209 | * | |
210 | * @return string | |
211 | */ | |
c3fc2621 | 212 | public static function getTableName() { |
e501603b TO |
213 | return self::$_tableName; |
214 | } | |
c3fc2621 | 215 | |
e501603b TO |
216 | /** |
217 | * Returns if this table needs to be logged | |
218 | * | |
c3fc2621 | 219 | * @return bool |
e501603b | 220 | */ |
c3fc2621 | 221 | public function getLog() { |
e501603b TO |
222 | return self::$_log; |
223 | } | |
c3fc2621 | 224 | |
e501603b TO |
225 | /** |
226 | * Returns the list of fields that can be imported | |
227 | * | |
228 | * @param bool $prefix | |
229 | * | |
230 | * @return array | |
231 | */ | |
c3fc2621 CW |
232 | public static function &import($prefix = FALSE) { |
233 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, []); | |
60808919 | 234 | return $r; |
e501603b | 235 | } |
c3fc2621 | 236 | |
e501603b TO |
237 | /** |
238 | * Returns the list of fields that can be exported | |
239 | * | |
240 | * @param bool $prefix | |
241 | * | |
242 | * @return array | |
243 | */ | |
c3fc2621 CW |
244 | public static function &export($prefix = FALSE) { |
245 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, []); | |
60808919 | 246 | return $r; |
e501603b | 247 | } |
c3fc2621 | 248 | |
e7a6b91a AS |
249 | /** |
250 | * Returns the list of indices | |
c3fc2621 CW |
251 | * |
252 | * @param bool $localize | |
253 | * | |
254 | * @return array | |
e7a6b91a AS |
255 | */ |
256 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
257 | $indices = [ |
258 | 'UI_domain_find' => [ | |
e7a6b91a | 259 | 'name' => 'UI_domain_find', |
c3fc2621 | 260 | 'field' => [ |
e7a6b91a AS |
261 | 0 => 'domain_id', |
262 | 1 => 'find_word', | |
c3fc2621 CW |
263 | ], |
264 | 'localizable' => FALSE, | |
265 | 'unique' => TRUE, | |
e7a6b91a | 266 | 'sig' => 'civicrm_word_replacement::1::domain_id::find_word', |
c3fc2621 CW |
267 | ], |
268 | ]; | |
e7a6b91a AS |
269 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
270 | } | |
c3fc2621 | 271 | |
e501603b | 272 | } |