Merge pull request #20450 from jaapjansma/dev_financials_6_reports
[civicrm-core.git] / CRM / Dedupe / DAO / DedupeRule.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Dedupe/DedupeRule.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:be34a32d6749dbd8caecac45f2086b61)
10 */
11
12 /**
13 * Database access object for the DedupeRule entity.
14 */
15 class CRM_Dedupe_DAO_DedupeRule extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.8';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_dedupe_rule';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Unique dedupe rule id
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * The id of the rule group this rule belongs to
42 *
43 * @var int
44 */
45 public $dedupe_rule_group_id;
46
47 /**
48 * The name of the table this rule is about
49 *
50 * @var string
51 */
52 public $rule_table;
53
54 /**
55 * The name of the field of the table referenced in rule_table
56 *
57 * @var string
58 */
59 public $rule_field;
60
61 /**
62 * The length of the matching substring
63 *
64 * @var int
65 */
66 public $rule_length;
67
68 /**
69 * The weight of the rule
70 *
71 * @var int
72 */
73 public $rule_weight;
74
75 /**
76 * Class constructor.
77 */
78 public function __construct() {
79 $this->__table = 'civicrm_dedupe_rule';
80 parent::__construct();
81 }
82
83 /**
84 * Returns localized title of this entity.
85 *
86 * @param bool $plural
87 * Whether to return the plural version of the title.
88 */
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ? ts('Dedupe Rules') : ts('Dedupe Rule');
91 }
92
93 /**
94 * Returns foreign keys and entity references.
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
99 public static function getReferenceColumns() {
100 if (!isset(Civi::$statics[__CLASS__]['links'])) {
101 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
103 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
104 }
105 return Civi::$statics[__CLASS__]['links'];
106 }
107
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
113 public static function &fields() {
114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
115 Civi::$statics[__CLASS__]['fields'] = [
116 'id' => [
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Dedupe Rule ID'),
120 'description' => ts('Unique dedupe rule id'),
121 'required' => TRUE,
122 'where' => 'civicrm_dedupe_rule.id',
123 'table_name' => 'civicrm_dedupe_rule',
124 'entity' => 'DedupeRule',
125 'bao' => 'CRM_Dedupe_BAO_DedupeRule',
126 'localizable' => 0,
127 'html' => [
128 'type' => 'Number',
129 ],
130 'readonly' => TRUE,
131 'add' => '1.8',
132 ],
133 'dedupe_rule_group_id' => [
134 'name' => 'dedupe_rule_group_id',
135 'type' => CRM_Utils_Type::T_INT,
136 'title' => ts('Group ID'),
137 'description' => ts('The id of the rule group this rule belongs to'),
138 'required' => TRUE,
139 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id',
140 'table_name' => 'civicrm_dedupe_rule',
141 'entity' => 'DedupeRule',
142 'bao' => 'CRM_Dedupe_BAO_DedupeRule',
143 'localizable' => 0,
144 'FKClassName' => 'CRM_Dedupe_DAO_DedupeRuleGroup',
145 'html' => [
146 'label' => ts("Group"),
147 ],
148 'add' => '1.8',
149 ],
150 'rule_table' => [
151 'name' => 'rule_table',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('Rule Table'),
154 'description' => ts('The name of the table this rule is about'),
155 'required' => TRUE,
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
158 'where' => 'civicrm_dedupe_rule.rule_table',
159 'table_name' => 'civicrm_dedupe_rule',
160 'entity' => 'DedupeRule',
161 'bao' => 'CRM_Dedupe_BAO_DedupeRule',
162 'localizable' => 0,
163 'add' => '1.8',
164 ],
165 'rule_field' => [
166 'name' => 'rule_field',
167 'type' => CRM_Utils_Type::T_STRING,
168 'title' => ts('Rule Field'),
169 'description' => ts('The name of the field of the table referenced in rule_table'),
170 'required' => TRUE,
171 'maxlength' => 64,
172 'size' => CRM_Utils_Type::BIG,
173 'where' => 'civicrm_dedupe_rule.rule_field',
174 'table_name' => 'civicrm_dedupe_rule',
175 'entity' => 'DedupeRule',
176 'bao' => 'CRM_Dedupe_BAO_DedupeRule',
177 'localizable' => 0,
178 'add' => '1.8',
179 ],
180 'rule_length' => [
181 'name' => 'rule_length',
182 'type' => CRM_Utils_Type::T_INT,
183 'title' => ts('Rule Length'),
184 'description' => ts('The length of the matching substring'),
185 'where' => 'civicrm_dedupe_rule.rule_length',
186 'table_name' => 'civicrm_dedupe_rule',
187 'entity' => 'DedupeRule',
188 'bao' => 'CRM_Dedupe_BAO_DedupeRule',
189 'localizable' => 0,
190 'html' => [
191 'type' => 'Text',
192 ],
193 'add' => '1.8',
194 ],
195 'rule_weight' => [
196 'name' => 'rule_weight',
197 'type' => CRM_Utils_Type::T_INT,
198 'title' => ts('Order'),
199 'description' => ts('The weight of the rule'),
200 'required' => TRUE,
201 'where' => 'civicrm_dedupe_rule.rule_weight',
202 'table_name' => 'civicrm_dedupe_rule',
203 'entity' => 'DedupeRule',
204 'bao' => 'CRM_Dedupe_BAO_DedupeRule',
205 'localizable' => 0,
206 'html' => [
207 'type' => 'Text',
208 ],
209 'add' => '1.8',
210 ],
211 ];
212 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
213 }
214 return Civi::$statics[__CLASS__]['fields'];
215 }
216
217 /**
218 * Return a mapping from field-name to the corresponding key (as used in fields()).
219 *
220 * @return array
221 * Array(string $name => string $uniqueName).
222 */
223 public static function &fieldKeys() {
224 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
225 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
226 }
227 return Civi::$statics[__CLASS__]['fieldKeys'];
228 }
229
230 /**
231 * Returns the names of this table
232 *
233 * @return string
234 */
235 public static function getTableName() {
236 return self::$_tableName;
237 }
238
239 /**
240 * Returns if this table needs to be logged
241 *
242 * @return bool
243 */
244 public function getLog() {
245 return self::$_log;
246 }
247
248 /**
249 * Returns the list of fields that can be imported
250 *
251 * @param bool $prefix
252 *
253 * @return array
254 */
255 public static function &import($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []);
257 return $r;
258 }
259
260 /**
261 * Returns the list of fields that can be exported
262 *
263 * @param bool $prefix
264 *
265 * @return array
266 */
267 public static function &export($prefix = FALSE) {
268 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []);
269 return $r;
270 }
271
272 /**
273 * Returns the list of indices
274 *
275 * @param bool $localize
276 *
277 * @return array
278 */
279 public static function indices($localize = TRUE) {
280 $indices = [];
281 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
282 }
283
284 }