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