Merge pull request #8980 from ergonlogic/dev/CRM-19308
[civicrm-core.git] / CRM / Dedupe / DAO / Rule.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Dedupe/Rule.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
522a26c9 33 * (GenCodeChecksum:04d8d83fcc9facdeae7f32f1f0f0134d)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Dedupe_DAO_Rule constructor.
39 */
e501603b
TO
40class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_dedupe_rule';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Unique dedupe rule id
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * The id of the rule group this rule belongs to
61 *
62 * @var int unsigned
63 */
64 public $dedupe_rule_group_id;
65 /**
66 * The name of the table this rule is about
67 *
68 * @var string
69 */
70 public $rule_table;
71 /**
72 * The name of the field of the table referenced in rule_table
73 *
74 * @var string
75 */
76 public $rule_field;
77 /**
78 * The length of the matching substring
79 *
80 * @var int unsigned
81 */
82 public $rule_length;
83 /**
84 * The weight of the rule
85 *
86 * @var int
87 */
88 public $rule_weight;
89 /**
f41f0342 90 * Class constructor.
e501603b
TO
91 */
92 function __construct() {
93 $this->__table = 'civicrm_dedupe_rule';
94 parent::__construct();
95 }
96 /**
f41f0342 97 * Returns foreign keys and entity references.
e501603b
TO
98 *
99 * @return array
100 * [CRM_Core_Reference_Interface]
101 */
102 static function getReferenceColumns() {
346aaaba
TO
103 if (!isset(Civi::$statics[__CLASS__]['links'])) {
104 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
105 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
106 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 107 }
346aaaba 108 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
109 }
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
115 static function &fields() {
346aaaba
TO
116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
117 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
118 'id' => array(
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
121 'title' => ts('Dedupe Rule ID') ,
122 'description' => 'Unique dedupe rule id',
123 'required' => true,
522a26c9 124 'table_name' => 'civicrm_dedupe_rule',
125 'entity' => 'Rule',
126 'bao' => 'CRM_Dedupe_BAO_Rule',
e501603b
TO
127 ) ,
128 'dedupe_rule_group_id' => array(
129 'name' => 'dedupe_rule_group_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Dedupe Rule Group') ,
132 'description' => 'The id of the rule group this rule belongs to',
133 'required' => true,
522a26c9 134 'table_name' => 'civicrm_dedupe_rule',
135 'entity' => 'Rule',
136 'bao' => 'CRM_Dedupe_BAO_Rule',
e501603b
TO
137 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
138 ) ,
139 'rule_table' => array(
140 'name' => 'rule_table',
141 'type' => CRM_Utils_Type::T_STRING,
142 'title' => ts('Rule Table') ,
143 'description' => 'The name of the table this rule is about',
144 'required' => true,
145 'maxlength' => 64,
146 'size' => CRM_Utils_Type::BIG,
522a26c9 147 'table_name' => 'civicrm_dedupe_rule',
148 'entity' => 'Rule',
149 'bao' => 'CRM_Dedupe_BAO_Rule',
e501603b
TO
150 ) ,
151 'rule_field' => array(
152 'name' => 'rule_field',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('Rule Field') ,
155 'description' => 'The name of the field of the table referenced in rule_table',
156 'required' => true,
157 'maxlength' => 64,
158 'size' => CRM_Utils_Type::BIG,
522a26c9 159 'table_name' => 'civicrm_dedupe_rule',
160 'entity' => 'Rule',
161 'bao' => 'CRM_Dedupe_BAO_Rule',
e501603b
TO
162 ) ,
163 'rule_length' => array(
164 'name' => 'rule_length',
165 'type' => CRM_Utils_Type::T_INT,
166 'title' => ts('Rule Length') ,
167 'description' => 'The length of the matching substring',
522a26c9 168 'table_name' => 'civicrm_dedupe_rule',
169 'entity' => 'Rule',
170 'bao' => 'CRM_Dedupe_BAO_Rule',
e501603b
TO
171 'html' => array(
172 'type' => 'Text',
173 ) ,
174 ) ,
175 'rule_weight' => array(
176 'name' => 'rule_weight',
177 'type' => CRM_Utils_Type::T_INT,
178 'title' => ts('Order') ,
179 'description' => 'The weight of the rule',
180 'required' => true,
522a26c9 181 'table_name' => 'civicrm_dedupe_rule',
182 'entity' => 'Rule',
183 'bao' => 'CRM_Dedupe_BAO_Rule',
e501603b
TO
184 'html' => array(
185 'type' => 'Text',
186 ) ,
187 ) ,
188 );
346aaaba 189 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 190 }
346aaaba 191 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
192 }
193 /**
bd8e0b14 194 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
195 *
196 * @return array
bd8e0b14 197 * Array(string $name => string $uniqueName).
e501603b
TO
198 */
199 static function &fieldKeys() {
bd8e0b14
TO
200 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
201 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 202 }
bd8e0b14 203 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
204 }
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
210 static function getTableName() {
211 return self::$_tableName;
212 }
213 /**
214 * Returns if this table needs to be logged
215 *
216 * @return boolean
217 */
218 function getLog() {
219 return self::$_log;
220 }
221 /**
222 * Returns the list of fields that can be imported
223 *
224 * @param bool $prefix
225 *
226 * @return array
227 */
228 static function &import($prefix = false) {
60808919
TO
229 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, array());
230 return $r;
e501603b
TO
231 }
232 /**
233 * Returns the list of fields that can be exported
234 *
235 * @param bool $prefix
236 *
237 * @return array
238 */
239 static function &export($prefix = false) {
60808919
TO
240 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, array());
241 return $r;
e501603b
TO
242 }
243}