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