xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Core / DAO / WordReplacement.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/Core/WordReplacement.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:92b2139ba33ee66fec3e6bb529af304e)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_word_replacement';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
e501603b
TO
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 * Word replacement ID
71 *
72 * @var int unsigned
73 */
74 public $id;
75 /**
76 * Word which need to be replaced
77 *
78 * @var string
79 */
80 public $find_word;
81 /**
82 * Word which will replace the word in find
83 *
84 * @var string
85 */
86 public $replace_word;
87 /**
88 * Is this entry active?
89 *
90 * @var boolean
91 */
92 public $is_active;
93 /**
94 *
95 * @var string
96 */
97 public $match_type;
98 /**
99 * FK to Domain ID. This is for Domain specific word replacement
100 *
101 * @var int unsigned
102 */
103 public $domain_id;
104 /**
105 * class constructor
106 *
107 * @return civicrm_word_replacement
108 */
109 function __construct() {
110 $this->__table = 'civicrm_word_replacement';
111 parent::__construct();
112 }
113 /**
114 * Returns foreign keys and entity references
115 *
116 * @return array
117 * [CRM_Core_Reference_Interface]
118 */
119 static function getReferenceColumns() {
120 if (!self::$_links) {
121 self::$_links = static ::createReferenceColumns(__CLASS__);
122 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'domain_id', 'civicrm_domain', 'id');
123 }
124 return self::$_links;
125 }
126 /**
127 * Returns all the column names of this table
128 *
129 * @return array
130 */
131 static function &fields() {
132 if (!(self::$_fields)) {
133 self::$_fields = array(
134 'id' => array(
135 'name' => 'id',
136 'type' => CRM_Utils_Type::T_INT,
137 'title' => ts('Word Replacement ID') ,
138 'description' => 'Word replacement ID',
139 'required' => true,
140 ) ,
141 'find_word' => array(
142 'name' => 'find_word',
143 'type' => CRM_Utils_Type::T_STRING,
144 'title' => ts('Replaced Word') ,
145 'description' => 'Word which need to be replaced',
146 'maxlength' => 255,
147 'size' => CRM_Utils_Type::HUGE,
148 ) ,
149 'replace_word' => array(
150 'name' => 'replace_word',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('Replacement Word') ,
153 'description' => 'Word which will replace the word in find',
154 'maxlength' => 255,
155 'size' => CRM_Utils_Type::HUGE,
156 ) ,
157 'is_active' => array(
158 'name' => 'is_active',
159 'type' => CRM_Utils_Type::T_BOOLEAN,
160 'title' => ts('Word Replacement is Active') ,
161 'description' => 'Is this entry active?',
162 'default' => '1',
163 ) ,
164 'match_type' => array(
165 'name' => 'match_type',
166 'type' => CRM_Utils_Type::T_STRING,
167 'title' => ts('Word Replacement Match Type') ,
168 'maxlength' => 16,
169 'size' => CRM_Utils_Type::TWELVE,
170 'default' => 'wildcardMatch',
171 'html' => array(
172 'type' => 'Select',
173 ) ,
174 'pseudoconstant' => array(
175 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType',
176 )
177 ) ,
178 'domain_id' => array(
179 'name' => 'domain_id',
180 'type' => CRM_Utils_Type::T_INT,
181 'title' => ts('Word Replacement Domain ID') ,
182 'description' => 'FK to Domain ID. This is for Domain specific word replacement',
183 'FKClassName' => 'CRM_Core_DAO_Domain',
184 'pseudoconstant' => array(
185 'table' => 'civicrm_domain',
186 'keyColumn' => 'id',
187 'labelColumn' => 'name',
188 )
189 ) ,
190 );
191 }
192 return self::$_fields;
193 }
194 /**
195 * Returns an array containing, for each field, the arary key used for that
196 * field in self::$_fields.
197 *
198 * @return array
199 */
200 static function &fieldKeys() {
201 if (!(self::$_fieldKeys)) {
202 self::$_fieldKeys = array(
203 'id' => 'id',
204 'find_word' => 'find_word',
205 'replace_word' => 'replace_word',
206 'is_active' => 'is_active',
207 'match_type' => 'match_type',
208 'domain_id' => 'domain_id',
209 );
210 }
211 return self::$_fieldKeys;
212 }
213 /**
214 * Returns the names of this table
215 *
216 * @return string
217 */
218 static function getTableName() {
219 return self::$_tableName;
220 }
221 /**
222 * Returns if this table needs to be logged
223 *
224 * @return boolean
225 */
226 function getLog() {
227 return self::$_log;
228 }
229 /**
230 * Returns the list of fields that can be imported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
236 static function &import($prefix = false) {
60808919
TO
237 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'word_replacement', $prefix, array());
238 return $r;
e501603b
TO
239 }
240 /**
241 * Returns the list of fields that can be exported
242 *
243 * @param bool $prefix
244 *
245 * @return array
246 */
247 static function &export($prefix = false) {
60808919
TO
248 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'word_replacement', $prefix, array());
249 return $r;
e501603b
TO
250 }
251}