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