xml/templates/dao.tpl - Simplify fieldKeys()
[civicrm-core.git] / CRM / Dedupe / DAO / Rule.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/Dedupe/Rule.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:083bfadf2e54fb13a6875d14f2e52b5a)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class 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 instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
e501603b
TO
62 /**
63 * static value to see if we should log any modifications to
64 * this table in the civicrm_log table
65 *
66 * @var boolean
67 */
68 static $_log = false;
69 /**
70 * Unique dedupe rule id
71 *
72 * @var int unsigned
73 */
74 public $id;
75 /**
76 * The id of the rule group this rule belongs to
77 *
78 * @var int unsigned
79 */
80 public $dedupe_rule_group_id;
81 /**
82 * The name of the table this rule is about
83 *
84 * @var string
85 */
86 public $rule_table;
87 /**
88 * The name of the field of the table referenced in rule_table
89 *
90 * @var string
91 */
92 public $rule_field;
93 /**
94 * The length of the matching substring
95 *
96 * @var int unsigned
97 */
98 public $rule_length;
99 /**
100 * The weight of the rule
101 *
102 * @var int
103 */
104 public $rule_weight;
105 /**
106 * class constructor
107 *
108 * @return civicrm_dedupe_rule
109 */
110 function __construct() {
111 $this->__table = 'civicrm_dedupe_rule';
112 parent::__construct();
113 }
114 /**
115 * Returns foreign keys and entity references
116 *
117 * @return array
118 * [CRM_Core_Reference_Interface]
119 */
120 static function getReferenceColumns() {
121 if (!self::$_links) {
122 self::$_links = static ::createReferenceColumns(__CLASS__);
123 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
124 }
125 return self::$_links;
126 }
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 static function &fields() {
133 if (!(self::$_fields)) {
134 self::$_fields = array(
135 'id' => array(
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Dedupe Rule ID') ,
139 'description' => 'Unique dedupe rule id',
140 'required' => true,
141 ) ,
142 'dedupe_rule_group_id' => array(
143 'name' => 'dedupe_rule_group_id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('Dedupe Rule Group') ,
146 'description' => 'The id of the rule group this rule belongs to',
147 'required' => true,
148 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
149 ) ,
150 'rule_table' => array(
151 'name' => 'rule_table',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('Rule Table') ,
154 'description' => 'The name of the table this rule is about',
155 'required' => true,
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
158 ) ,
159 'rule_field' => array(
160 'name' => 'rule_field',
161 'type' => CRM_Utils_Type::T_STRING,
162 'title' => ts('Rule Field') ,
163 'description' => 'The name of the field of the table referenced in rule_table',
164 'required' => true,
165 'maxlength' => 64,
166 'size' => CRM_Utils_Type::BIG,
167 ) ,
168 'rule_length' => array(
169 'name' => 'rule_length',
170 'type' => CRM_Utils_Type::T_INT,
171 'title' => ts('Rule Length') ,
172 'description' => 'The length of the matching substring',
173 'html' => array(
174 'type' => 'Text',
175 ) ,
176 ) ,
177 'rule_weight' => array(
178 'name' => 'rule_weight',
179 'type' => CRM_Utils_Type::T_INT,
180 'title' => ts('Order') ,
181 'description' => 'The weight of the rule',
182 'required' => true,
183 'html' => array(
184 'type' => 'Text',
185 ) ,
186 ) ,
187 );
188 }
189 return self::$_fields;
190 }
191 /**
192 * Returns an array containing, for each field, the arary key used for that
193 * field in self::$_fields.
194 *
195 * @return array
196 */
197 static function &fieldKeys() {
198 if (!(self::$_fieldKeys)) {
199 self::$_fieldKeys = array(
200 'id' => 'id',
201 'dedupe_rule_group_id' => 'dedupe_rule_group_id',
202 'rule_table' => 'rule_table',
203 'rule_field' => 'rule_field',
204 'rule_length' => 'rule_length',
205 'rule_weight' => 'rule_weight',
206 );
207 }
208 return self::$_fieldKeys;
209 }
210 /**
211 * Returns the names of this table
212 *
213 * @return string
214 */
215 static function getTableName() {
216 return self::$_tableName;
217 }
218 /**
219 * Returns if this table needs to be logged
220 *
221 * @return boolean
222 */
223 function getLog() {
224 return self::$_log;
225 }
226 /**
227 * Returns the list of fields that can be imported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
233 static function &import($prefix = false) {
60808919
TO
234 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, array());
235 return $r;
e501603b
TO
236 }
237 /**
238 * Returns the list of fields that can be exported
239 *
240 * @param bool $prefix
241 *
242 * @return array
243 */
244 static function &export($prefix = false) {
60808919
TO
245 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, array());
246 return $r;
e501603b
TO
247 }
248}