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