Merge pull request #10115 from jmcclelland/CRM-20388
[civicrm-core.git] / CRM / Core / DAO / WordReplacement.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Core/WordReplacement.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:550a500d2c0a05672ebf9e2a47d54d69)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_WordReplacement constructor.
39 */
40 class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_word_replacement';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Word replacement ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Word which need to be replaced
61 *
62 * @var string
63 */
64 public $find_word;
65 /**
66 * Word which will replace the word in find
67 *
68 * @var string
69 */
70 public $replace_word;
71 /**
72 * Is this entry active?
73 *
74 * @var boolean
75 */
76 public $is_active;
77 /**
78 *
79 * @var string
80 */
81 public $match_type;
82 /**
83 * FK to Domain ID. This is for Domain specific word replacement
84 *
85 * @var int unsigned
86 */
87 public $domain_id;
88 /**
89 * Class constructor.
90 */
91 function __construct() {
92 $this->__table = 'civicrm_word_replacement';
93 parent::__construct();
94 }
95 /**
96 * Returns foreign keys and entity references.
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
101 static function getReferenceColumns() {
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
104 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
105 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
106 }
107 return Civi::$statics[__CLASS__]['links'];
108 }
109 /**
110 * Returns all the column names of this table
111 *
112 * @return array
113 */
114 static function &fields() {
115 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
116 Civi::$statics[__CLASS__]['fields'] = array(
117 'id' => array(
118 'name' => 'id',
119 'type' => CRM_Utils_Type::T_INT,
120 'title' => ts('Word Replacement ID') ,
121 'description' => 'Word replacement ID',
122 'required' => true,
123 'table_name' => 'civicrm_word_replacement',
124 'entity' => 'WordReplacement',
125 'bao' => 'CRM_Core_BAO_WordReplacement',
126 'localizable' => 0,
127 ) ,
128 'find_word' => array(
129 'name' => 'find_word',
130 'type' => CRM_Utils_Type::T_STRING,
131 'title' => ts('Replaced Word') ,
132 'description' => 'Word which need to be replaced',
133 'maxlength' => 255,
134 'size' => CRM_Utils_Type::HUGE,
135 'table_name' => 'civicrm_word_replacement',
136 'entity' => 'WordReplacement',
137 'bao' => 'CRM_Core_BAO_WordReplacement',
138 'localizable' => 0,
139 ) ,
140 'replace_word' => array(
141 'name' => 'replace_word',
142 'type' => CRM_Utils_Type::T_STRING,
143 'title' => ts('Replacement Word') ,
144 'description' => 'Word which will replace the word in find',
145 'maxlength' => 255,
146 'size' => CRM_Utils_Type::HUGE,
147 'table_name' => 'civicrm_word_replacement',
148 'entity' => 'WordReplacement',
149 'bao' => 'CRM_Core_BAO_WordReplacement',
150 'localizable' => 0,
151 ) ,
152 'is_active' => array(
153 'name' => 'is_active',
154 'type' => CRM_Utils_Type::T_BOOLEAN,
155 'title' => ts('Word Replacement is Active') ,
156 'description' => 'Is this entry active?',
157 'default' => '1',
158 'table_name' => 'civicrm_word_replacement',
159 'entity' => 'WordReplacement',
160 'bao' => 'CRM_Core_BAO_WordReplacement',
161 'localizable' => 0,
162 ) ,
163 'match_type' => array(
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 'default' => 'wildcardMatch',
170 'table_name' => 'civicrm_word_replacement',
171 'entity' => 'WordReplacement',
172 'bao' => 'CRM_Core_BAO_WordReplacement',
173 'localizable' => 0,
174 'html' => array(
175 'type' => 'Select',
176 ) ,
177 'pseudoconstant' => array(
178 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType',
179 )
180 ) ,
181 'domain_id' => array(
182 'name' => 'domain_id',
183 'type' => CRM_Utils_Type::T_INT,
184 'title' => ts('Word Replacement Domain ID') ,
185 'description' => 'FK to Domain ID. This is for Domain specific word replacement',
186 'table_name' => 'civicrm_word_replacement',
187 'entity' => 'WordReplacement',
188 'bao' => 'CRM_Core_BAO_WordReplacement',
189 'localizable' => 0,
190 'FKClassName' => 'CRM_Core_DAO_Domain',
191 'pseudoconstant' => array(
192 'table' => 'civicrm_domain',
193 'keyColumn' => 'id',
194 'labelColumn' => 'name',
195 )
196 ) ,
197 );
198 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
199 }
200 return Civi::$statics[__CLASS__]['fields'];
201 }
202 /**
203 * Return a mapping from field-name to the corresponding key (as used in fields()).
204 *
205 * @return array
206 * Array(string $name => string $uniqueName).
207 */
208 static function &fieldKeys() {
209 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
210 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
211 }
212 return Civi::$statics[__CLASS__]['fieldKeys'];
213 }
214 /**
215 * Returns the names of this table
216 *
217 * @return string
218 */
219 static function getTableName() {
220 return self::$_tableName;
221 }
222 /**
223 * Returns if this table needs to be logged
224 *
225 * @return boolean
226 */
227 function getLog() {
228 return self::$_log;
229 }
230 /**
231 * Returns the list of fields that can be imported
232 *
233 * @param bool $prefix
234 *
235 * @return array
236 */
237 static function &import($prefix = false) {
238 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, array());
239 return $r;
240 }
241 /**
242 * Returns the list of fields that can be exported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
248 static function &export($prefix = false) {
249 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, array());
250 return $r;
251 }
252 /**
253 * Returns the list of indices
254 */
255 public static function indices($localize = TRUE) {
256 $indices = array(
257 'UI_domain_find' => array(
258 'name' => 'UI_domain_find',
259 'field' => array(
260 0 => 'domain_id',
261 1 => 'find_word',
262 ) ,
263 'localizable' => false,
264 'unique' => true,
265 'sig' => 'civicrm_word_replacement::1::domain_id::find_word',
266 ) ,
267 );
268 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
269 }
270 }