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