Merge pull request #15370 from JMAConsulting/core-692-2
[civicrm-core.git] / CRM / Dedupe / DAO / Rule.php
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:30ac1f4265b98b426df72998fe049025)
10 */
11
12 /**
13 * Database access object for the Rule entity.
14 */
15 class 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
35 */
36 public $id;
37
38 /**
39 * The id of the rule group this rule belongs to
40 *
41 * @var int
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
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 'where' => 'civicrm_dedupe_rule.id',
111 'table_name' => 'civicrm_dedupe_rule',
112 'entity' => 'Rule',
113 'bao' => 'CRM_Dedupe_BAO_Rule',
114 'localizable' => 0,
115 ],
116 'dedupe_rule_group_id' => [
117 'name' => 'dedupe_rule_group_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Dedupe Rule Group'),
120 'description' => ts('The id of the rule group this rule belongs to'),
121 'required' => TRUE,
122 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id',
123 'table_name' => 'civicrm_dedupe_rule',
124 'entity' => 'Rule',
125 'bao' => 'CRM_Dedupe_BAO_Rule',
126 'localizable' => 0,
127 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
128 ],
129 'rule_table' => [
130 'name' => 'rule_table',
131 'type' => CRM_Utils_Type::T_STRING,
132 'title' => ts('Rule Table'),
133 'description' => ts('The name of the table this rule is about'),
134 'required' => TRUE,
135 'maxlength' => 64,
136 'size' => CRM_Utils_Type::BIG,
137 'where' => 'civicrm_dedupe_rule.rule_table',
138 'table_name' => 'civicrm_dedupe_rule',
139 'entity' => 'Rule',
140 'bao' => 'CRM_Dedupe_BAO_Rule',
141 'localizable' => 0,
142 ],
143 'rule_field' => [
144 'name' => 'rule_field',
145 'type' => CRM_Utils_Type::T_STRING,
146 'title' => ts('Rule Field'),
147 'description' => ts('The name of the field of the table referenced in rule_table'),
148 'required' => TRUE,
149 'maxlength' => 64,
150 'size' => CRM_Utils_Type::BIG,
151 'where' => 'civicrm_dedupe_rule.rule_field',
152 'table_name' => 'civicrm_dedupe_rule',
153 'entity' => 'Rule',
154 'bao' => 'CRM_Dedupe_BAO_Rule',
155 'localizable' => 0,
156 ],
157 'rule_length' => [
158 'name' => 'rule_length',
159 'type' => CRM_Utils_Type::T_INT,
160 'title' => ts('Rule Length'),
161 'description' => ts('The length of the matching substring'),
162 'where' => 'civicrm_dedupe_rule.rule_length',
163 'table_name' => 'civicrm_dedupe_rule',
164 'entity' => 'Rule',
165 'bao' => 'CRM_Dedupe_BAO_Rule',
166 'localizable' => 0,
167 'html' => [
168 'type' => 'Text',
169 ],
170 ],
171 'rule_weight' => [
172 'name' => 'rule_weight',
173 'type' => CRM_Utils_Type::T_INT,
174 'title' => ts('Order'),
175 'description' => ts('The weight of the rule'),
176 'required' => TRUE,
177 'where' => 'civicrm_dedupe_rule.rule_weight',
178 'table_name' => 'civicrm_dedupe_rule',
179 'entity' => 'Rule',
180 'bao' => 'CRM_Dedupe_BAO_Rule',
181 'localizable' => 0,
182 'html' => [
183 'type' => 'Text',
184 ],
185 ],
186 ];
187 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
188 }
189 return Civi::$statics[__CLASS__]['fields'];
190 }
191
192 /**
193 * Return a mapping from field-name to the corresponding key (as used in fields()).
194 *
195 * @return array
196 * Array(string $name => string $uniqueName).
197 */
198 public static function &fieldKeys() {
199 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
200 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
201 }
202 return Civi::$statics[__CLASS__]['fieldKeys'];
203 }
204
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
210 public static function getTableName() {
211 return self::$_tableName;
212 }
213
214 /**
215 * Returns if this table needs to be logged
216 *
217 * @return bool
218 */
219 public function getLog() {
220 return self::$_log;
221 }
222
223 /**
224 * Returns the list of fields that can be imported
225 *
226 * @param bool $prefix
227 *
228 * @return array
229 */
230 public static function &import($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []);
232 return $r;
233 }
234
235 /**
236 * Returns the list of fields that can be exported
237 *
238 * @param bool $prefix
239 *
240 * @return array
241 */
242 public static function &export($prefix = FALSE) {
243 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []);
244 return $r;
245 }
246
247 /**
248 * Returns the list of indices
249 *
250 * @param bool $localize
251 *
252 * @return array
253 */
254 public static function indices($localize = TRUE) {
255 $indices = [];
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
257 }
258
259 }