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