Merge pull request #17698 from agh1/checkwpbasepage
[civicrm-core.git] / CRM / Dedupe / DAO / Rule.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Dedupe/Rule.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e218ab6aaed8b58ef6dc189845a36755)
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 localized title of this entity.
83 */
84 public static function getEntityTitle() {
85 return ts('Rules');
86 }
87
88 /**
89 * Returns foreign keys and entity references.
90 *
91 * @return array
92 * [CRM_Core_Reference_Interface]
93 */
94 public static function getReferenceColumns() {
95 if (!isset(Civi::$statics[__CLASS__]['links'])) {
96 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
97 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
98 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
99 }
100 return Civi::$statics[__CLASS__]['links'];
101 }
102
103 /**
104 * Returns all the column names of this table
105 *
106 * @return array
107 */
108 public static function &fields() {
109 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
110 Civi::$statics[__CLASS__]['fields'] = [
111 'id' => [
112 'name' => 'id',
113 'type' => CRM_Utils_Type::T_INT,
114 'title' => ts('Dedupe Rule ID'),
115 'description' => ts('Unique dedupe rule id'),
116 'required' => TRUE,
117 'where' => 'civicrm_dedupe_rule.id',
118 'table_name' => 'civicrm_dedupe_rule',
119 'entity' => 'Rule',
120 'bao' => 'CRM_Dedupe_BAO_Rule',
121 'localizable' => 0,
122 'add' => '1.8',
123 ],
124 'dedupe_rule_group_id' => [
125 'name' => 'dedupe_rule_group_id',
126 'type' => CRM_Utils_Type::T_INT,
127 'title' => ts('Dedupe Rule Group'),
128 'description' => ts('The id of the rule group this rule belongs to'),
129 'required' => TRUE,
130 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id',
131 'table_name' => 'civicrm_dedupe_rule',
132 'entity' => 'Rule',
133 'bao' => 'CRM_Dedupe_BAO_Rule',
134 'localizable' => 0,
135 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
136 'add' => '1.8',
137 ],
138 'rule_table' => [
139 'name' => 'rule_table',
140 'type' => CRM_Utils_Type::T_STRING,
141 'title' => ts('Rule Table'),
142 'description' => ts('The name of the table this rule is about'),
143 'required' => TRUE,
144 'maxlength' => 64,
145 'size' => CRM_Utils_Type::BIG,
146 'where' => 'civicrm_dedupe_rule.rule_table',
147 'table_name' => 'civicrm_dedupe_rule',
148 'entity' => 'Rule',
149 'bao' => 'CRM_Dedupe_BAO_Rule',
150 'localizable' => 0,
151 'add' => '1.8',
152 ],
153 'rule_field' => [
154 'name' => 'rule_field',
155 'type' => CRM_Utils_Type::T_STRING,
156 'title' => ts('Rule Field'),
157 'description' => ts('The name of the field of the table referenced in rule_table'),
158 'required' => TRUE,
159 'maxlength' => 64,
160 'size' => CRM_Utils_Type::BIG,
161 'where' => 'civicrm_dedupe_rule.rule_field',
162 'table_name' => 'civicrm_dedupe_rule',
163 'entity' => 'Rule',
164 'bao' => 'CRM_Dedupe_BAO_Rule',
165 'localizable' => 0,
166 'add' => '1.8',
167 ],
168 'rule_length' => [
169 'name' => 'rule_length',
170 'type' => CRM_Utils_Type::T_INT,
171 'title' => ts('Rule Length'),
172 'description' => ts('The length of the matching substring'),
173 'where' => 'civicrm_dedupe_rule.rule_length',
174 'table_name' => 'civicrm_dedupe_rule',
175 'entity' => 'Rule',
176 'bao' => 'CRM_Dedupe_BAO_Rule',
177 'localizable' => 0,
178 'html' => [
179 'type' => 'Text',
180 ],
181 'add' => '1.8',
182 ],
183 'rule_weight' => [
184 'name' => 'rule_weight',
185 'type' => CRM_Utils_Type::T_INT,
186 'title' => ts('Order'),
187 'description' => ts('The weight of the rule'),
188 'required' => TRUE,
189 'where' => 'civicrm_dedupe_rule.rule_weight',
190 'table_name' => 'civicrm_dedupe_rule',
191 'entity' => 'Rule',
192 'bao' => 'CRM_Dedupe_BAO_Rule',
193 'localizable' => 0,
194 'html' => [
195 'type' => 'Text',
196 ],
197 'add' => '1.8',
198 ],
199 ];
200 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
201 }
202 return Civi::$statics[__CLASS__]['fields'];
203 }
204
205 /**
206 * Return a mapping from field-name to the corresponding key (as used in fields()).
207 *
208 * @return array
209 * Array(string $name => string $uniqueName).
210 */
211 public static function &fieldKeys() {
212 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
213 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
214 }
215 return Civi::$statics[__CLASS__]['fieldKeys'];
216 }
217
218 /**
219 * Returns the names of this table
220 *
221 * @return string
222 */
223 public static function getTableName() {
224 return self::$_tableName;
225 }
226
227 /**
228 * Returns if this table needs to be logged
229 *
230 * @return bool
231 */
232 public function getLog() {
233 return self::$_log;
234 }
235
236 /**
237 * Returns the list of fields that can be imported
238 *
239 * @param bool $prefix
240 *
241 * @return array
242 */
243 public static function &import($prefix = FALSE) {
244 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []);
245 return $r;
246 }
247
248 /**
249 * Returns the list of fields that can be exported
250 *
251 * @param bool $prefix
252 *
253 * @return array
254 */
255 public static function &export($prefix = FALSE) {
256 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []);
257 return $r;
258 }
259
260 /**
261 * Returns the list of indices
262 *
263 * @param bool $localize
264 *
265 * @return array
266 */
267 public static function indices($localize = TRUE) {
268 $indices = [];
269 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
270 }
271
272 }