5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Dedupe/Rule.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:56abeb7ada5e3dfde910bc5033ca047d)
13 * Database access object for the Rule entity.
15 class CRM_Dedupe_DAO_Rule
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.8';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_dedupe_rule';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
34 * Unique dedupe rule id
41 * The id of the rule group this rule belongs to
45 public $dedupe_rule_group_id;
48 * The name of the table this rule is about
55 * The name of the field of the table referenced in rule_table
62 * The length of the matching substring
69 * The weight of the rule
78 public function __construct() {
79 $this->__table
= 'civicrm_dedupe_rule';
80 parent
::__construct();
84 * Returns localized title of this entity.
86 public static function getEntityTitle() {
91 * Returns foreign keys and entity references.
94 * [CRM_Core_Reference_Interface]
96 public static function getReferenceColumns() {
97 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
98 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
99 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
100 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
102 return Civi
::$statics[__CLASS__
]['links'];
106 * Returns all the column names of this table
110 public static function &fields() {
111 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
112 Civi
::$statics[__CLASS__
]['fields'] = [
115 'type' => CRM_Utils_Type
::T_INT
,
116 'title' => ts('Dedupe Rule ID'),
117 'description' => ts('Unique dedupe rule id'),
119 'where' => 'civicrm_dedupe_rule.id',
120 'table_name' => 'civicrm_dedupe_rule',
122 'bao' => 'CRM_Dedupe_BAO_Rule',
126 'dedupe_rule_group_id' => [
127 'name' => 'dedupe_rule_group_id',
128 'type' => CRM_Utils_Type
::T_INT
,
129 'title' => ts('Dedupe Rule Group'),
130 'description' => ts('The id of the rule group this rule belongs to'),
132 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id',
133 'table_name' => 'civicrm_dedupe_rule',
135 'bao' => 'CRM_Dedupe_BAO_Rule',
137 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
141 'name' => 'rule_table',
142 'type' => CRM_Utils_Type
::T_STRING
,
143 'title' => ts('Rule Table'),
144 'description' => ts('The name of the table this rule is about'),
147 'size' => CRM_Utils_Type
::BIG
,
148 'where' => 'civicrm_dedupe_rule.rule_table',
149 'table_name' => 'civicrm_dedupe_rule',
151 'bao' => 'CRM_Dedupe_BAO_Rule',
156 'name' => 'rule_field',
157 'type' => CRM_Utils_Type
::T_STRING
,
158 'title' => ts('Rule Field'),
159 'description' => ts('The name of the field of the table referenced in rule_table'),
162 'size' => CRM_Utils_Type
::BIG
,
163 'where' => 'civicrm_dedupe_rule.rule_field',
164 'table_name' => 'civicrm_dedupe_rule',
166 'bao' => 'CRM_Dedupe_BAO_Rule',
171 'name' => 'rule_length',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'title' => ts('Rule Length'),
174 'description' => ts('The length of the matching substring'),
175 'where' => 'civicrm_dedupe_rule.rule_length',
176 'table_name' => 'civicrm_dedupe_rule',
178 'bao' => 'CRM_Dedupe_BAO_Rule',
186 'name' => 'rule_weight',
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Order'),
189 'description' => ts('The weight of the rule'),
191 'where' => 'civicrm_dedupe_rule.rule_weight',
192 'table_name' => 'civicrm_dedupe_rule',
194 'bao' => 'CRM_Dedupe_BAO_Rule',
202 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
204 return Civi
::$statics[__CLASS__
]['fields'];
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
211 * Array(string $name => string $uniqueName).
213 public static function &fieldKeys() {
214 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
215 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
217 return Civi
::$statics[__CLASS__
]['fieldKeys'];
221 * Returns the names of this table
225 public static function getTableName() {
226 return self
::$_tableName;
230 * Returns if this table needs to be logged
234 public function getLog() {
239 * Returns the list of fields that can be imported
241 * @param bool $prefix
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'dedupe_rule', $prefix, []);
251 * Returns the list of fields that can be exported
253 * @param bool $prefix
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'dedupe_rule', $prefix, []);
263 * Returns the list of indices
265 * @param bool $localize
269 public static function indices($localize = TRUE) {
271 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;