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