5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/WordReplacement.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:705cadb5a39522334249027149873712)
13 * Database access object for the WordReplacement entity.
15 class CRM_Core_DAO_WordReplacement
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '4.4';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_word_replacement';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * Word which need to be replaced
46 * (SQL type: varchar(255))
47 * Note that values will be retrieved from the database as a string.
52 * Word which will replace the word in find
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
61 * Is this entry active?
63 * @var bool|string|null
65 * Note that values will be retrieved from the database as a string.
71 * (SQL type: varchar(16))
72 * Note that values will be retrieved from the database as a string.
77 * FK to Domain ID. This is for Domain specific word replacement
79 * @var int|string|null
80 * (SQL type: int unsigned)
81 * Note that values will be retrieved from the database as a string.
88 public function __construct() {
89 $this->__table
= 'civicrm_word_replacement';
90 parent
::__construct();
94 * Returns localized title of this entity.
97 * Whether to return the plural version of the title.
99 public static function getEntityTitle($plural = FALSE) {
100 return $plural ?
ts('Word Replacements') : ts('Word Replacement');
104 * Returns foreign keys and entity references.
107 * [CRM_Core_Reference_Interface]
109 public static function getReferenceColumns() {
110 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
111 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
112 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'domain_id', 'civicrm_domain', 'id');
113 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
115 return Civi
::$statics[__CLASS__
]['links'];
119 * Returns all the column names of this table
123 public static function &fields() {
124 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
125 Civi
::$statics[__CLASS__
]['fields'] = [
128 'type' => CRM_Utils_Type
::T_INT
,
129 'title' => ts('Word Replacement ID'),
130 'description' => ts('Word replacement ID'),
132 'where' => 'civicrm_word_replacement.id',
133 'table_name' => 'civicrm_word_replacement',
134 'entity' => 'WordReplacement',
135 'bao' => 'CRM_Core_BAO_WordReplacement',
144 'name' => 'find_word',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Replaced Word'),
147 'description' => ts('Word which need to be replaced'),
149 'size' => CRM_Utils_Type
::HUGE
,
150 'where' => 'civicrm_word_replacement.find_word',
151 'table_name' => 'civicrm_word_replacement',
152 'entity' => 'WordReplacement',
153 'bao' => 'CRM_Core_BAO_WordReplacement',
158 'name' => 'replace_word',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Replacement Word'),
161 'description' => ts('Word which will replace the word in find'),
163 'size' => CRM_Utils_Type
::HUGE
,
164 'where' => 'civicrm_word_replacement.replace_word',
165 'table_name' => 'civicrm_word_replacement',
166 'entity' => 'WordReplacement',
167 'bao' => 'CRM_Core_BAO_WordReplacement',
172 'name' => 'is_active',
173 'type' => CRM_Utils_Type
::T_BOOLEAN
,
174 'title' => ts('Word Replacement is Active'),
175 'description' => ts('Is this entry active?'),
176 'where' => 'civicrm_word_replacement.is_active',
178 'table_name' => 'civicrm_word_replacement',
179 'entity' => 'WordReplacement',
180 'bao' => 'CRM_Core_BAO_WordReplacement',
185 'name' => 'match_type',
186 'type' => CRM_Utils_Type
::T_STRING
,
187 'title' => ts('Word Replacement Match Type'),
189 'size' => CRM_Utils_Type
::TWELVE
,
190 'where' => 'civicrm_word_replacement.match_type',
191 'default' => 'wildcardMatch',
192 'table_name' => 'civicrm_word_replacement',
193 'entity' => 'WordReplacement',
194 'bao' => 'CRM_Core_BAO_WordReplacement',
199 'pseudoconstant' => [
200 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType',
205 'name' => 'domain_id',
206 'type' => CRM_Utils_Type
::T_INT
,
207 'title' => ts('Domain ID'),
208 'description' => ts('FK to Domain ID. This is for Domain specific word replacement'),
209 'where' => 'civicrm_word_replacement.domain_id',
210 'table_name' => 'civicrm_word_replacement',
211 'entity' => 'WordReplacement',
212 'bao' => 'CRM_Core_BAO_WordReplacement',
214 'FKClassName' => 'CRM_Core_DAO_Domain',
216 'label' => ts("Domain"),
218 'pseudoconstant' => [
219 'table' => 'civicrm_domain',
221 'labelColumn' => 'name',
226 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
228 return Civi
::$statics[__CLASS__
]['fields'];
232 * Return a mapping from field-name to the corresponding key (as used in fields()).
235 * Array(string $name => string $uniqueName).
237 public static function &fieldKeys() {
238 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
239 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
241 return Civi
::$statics[__CLASS__
]['fieldKeys'];
245 * Returns the names of this table
249 public static function getTableName() {
250 return self
::$_tableName;
254 * Returns if this table needs to be logged
258 public function getLog() {
263 * Returns the list of fields that can be imported
265 * @param bool $prefix
269 public static function &import($prefix = FALSE) {
270 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'word_replacement', $prefix, []);
275 * Returns the list of fields that can be exported
277 * @param bool $prefix
281 public static function &export($prefix = FALSE) {
282 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'word_replacement', $prefix, []);
287 * Returns the list of indices
289 * @param bool $localize
293 public static function indices($localize = TRUE) {
295 'UI_domain_find' => [
296 'name' => 'UI_domain_find',
301 'localizable' => FALSE,
303 'sig' => 'civicrm_word_replacement::1::domain_id::find_word',
306 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;