Merge pull request #9594 from alifrumin/crm19807
[civicrm-core.git] / CRM / Dedupe / DAO / Rule.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Dedupe/Rule.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:083bfadf2e54fb13a6875d14f2e52b5a)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_dedupe_rule';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Unique dedupe rule id
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * The id of the rule group this rule belongs to
59 *
60 * @var int unsigned
61 */
62 public $dedupe_rule_group_id;
63 /**
64 * The name of the table this rule is about
65 *
66 * @var string
67 */
68 public $rule_table;
69 /**
70 * The name of the field of the table referenced in rule_table
71 *
72 * @var string
73 */
74 public $rule_field;
75 /**
76 * The length of the matching substring
77 *
78 * @var int unsigned
79 */
80 public $rule_length;
81 /**
82 * The weight of the rule
83 *
84 * @var int
85 */
86 public $rule_weight;
87 /**
88 * class constructor
89 *
90 * @return civicrm_dedupe_rule
91 */
92 function __construct() {
93 $this->__table = 'civicrm_dedupe_rule';
94 parent::__construct();
95 }
96 /**
97 * Returns foreign keys and entity references
98 *
99 * @return array
100 * [CRM_Core_Reference_Interface]
101 */
102 static function getReferenceColumns() {
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']);
107 }
108 return Civi::$statics[__CLASS__]['links'];
109 }
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
115 static function &fields() {
116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
117 Civi::$statics[__CLASS__]['fields'] = array(
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,
124 ) ,
125 'dedupe_rule_group_id' => array(
126 'name' => 'dedupe_rule_group_id',
127 'type' => CRM_Utils_Type::T_INT,
128 'title' => ts('Dedupe Rule Group') ,
129 'description' => 'The id of the rule group this rule belongs to',
130 'required' => true,
131 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
132 ) ,
133 'rule_table' => array(
134 'name' => 'rule_table',
135 'type' => CRM_Utils_Type::T_STRING,
136 'title' => ts('Rule Table') ,
137 'description' => 'The name of the table this rule is about',
138 'required' => true,
139 'maxlength' => 64,
140 'size' => CRM_Utils_Type::BIG,
141 ) ,
142 'rule_field' => array(
143 'name' => 'rule_field',
144 'type' => CRM_Utils_Type::T_STRING,
145 'title' => ts('Rule Field') ,
146 'description' => 'The name of the field of the table referenced in rule_table',
147 'required' => true,
148 'maxlength' => 64,
149 'size' => CRM_Utils_Type::BIG,
150 ) ,
151 'rule_length' => array(
152 'name' => 'rule_length',
153 'type' => CRM_Utils_Type::T_INT,
154 'title' => ts('Rule Length') ,
155 'description' => 'The length of the matching substring',
156 'html' => array(
157 'type' => 'Text',
158 ) ,
159 ) ,
160 'rule_weight' => array(
161 'name' => 'rule_weight',
162 'type' => CRM_Utils_Type::T_INT,
163 'title' => ts('Order') ,
164 'description' => 'The weight of the rule',
165 'required' => true,
166 'html' => array(
167 'type' => 'Text',
168 ) ,
169 ) ,
170 );
171 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
172 }
173 return Civi::$statics[__CLASS__]['fields'];
174 }
175 /**
176 * Return a mapping from field-name to the corresponding key (as used in fields()).
177 *
178 * @return array
179 * Array(string $name => string $uniqueName).
180 */
181 static function &fieldKeys() {
182 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
183 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
184 }
185 return Civi::$statics[__CLASS__]['fieldKeys'];
186 }
187 /**
188 * Returns the names of this table
189 *
190 * @return string
191 */
192 static function getTableName() {
193 return self::$_tableName;
194 }
195 /**
196 * Returns if this table needs to be logged
197 *
198 * @return boolean
199 */
200 function getLog() {
201 return self::$_log;
202 }
203 /**
204 * Returns the list of fields that can be imported
205 *
206 * @param bool $prefix
207 *
208 * @return array
209 */
210 static function &import($prefix = false) {
211 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, array());
212 return $r;
213 }
214 /**
215 * Returns the list of fields that can be exported
216 *
217 * @param bool $prefix
218 *
219 * @return array
220 */
221 static function &export($prefix = false) {
222 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, array());
223 return $r;
224 }
225 }