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