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:32900bb777ad3b4433835fb588ca9e8b)
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.
87 * Whether to return the plural version of the title.
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ?
ts('Rules') : ts('Rule');
94 * Returns foreign keys and entity references.
97 * [CRM_Core_Reference_Interface]
99 public static function getReferenceColumns() {
100 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
101 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
102 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'dedupe_rule_group_id', 'civicrm_dedupe_rule_group', 'id');
103 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
105 return Civi
::$statics[__CLASS__
]['links'];
109 * Returns all the column names of this table
113 public static function &fields() {
114 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
115 Civi
::$statics[__CLASS__
]['fields'] = [
118 'type' => CRM_Utils_Type
::T_INT
,
119 'title' => ts('Dedupe Rule ID'),
120 'description' => ts('Unique dedupe rule id'),
122 'where' => 'civicrm_dedupe_rule.id',
123 'table_name' => 'civicrm_dedupe_rule',
125 'bao' => 'CRM_Dedupe_BAO_Rule',
129 'dedupe_rule_group_id' => [
130 'name' => 'dedupe_rule_group_id',
131 'type' => CRM_Utils_Type
::T_INT
,
132 'title' => ts('Dedupe Rule Group'),
133 'description' => ts('The id of the rule group this rule belongs to'),
135 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id',
136 'table_name' => 'civicrm_dedupe_rule',
138 'bao' => 'CRM_Dedupe_BAO_Rule',
140 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup',
144 'name' => 'rule_table',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Rule Table'),
147 'description' => ts('The name of the table this rule is about'),
150 'size' => CRM_Utils_Type
::BIG
,
151 'where' => 'civicrm_dedupe_rule.rule_table',
152 'table_name' => 'civicrm_dedupe_rule',
154 'bao' => 'CRM_Dedupe_BAO_Rule',
159 'name' => 'rule_field',
160 'type' => CRM_Utils_Type
::T_STRING
,
161 'title' => ts('Rule Field'),
162 'description' => ts('The name of the field of the table referenced in rule_table'),
165 'size' => CRM_Utils_Type
::BIG
,
166 'where' => 'civicrm_dedupe_rule.rule_field',
167 'table_name' => 'civicrm_dedupe_rule',
169 'bao' => 'CRM_Dedupe_BAO_Rule',
174 'name' => 'rule_length',
175 'type' => CRM_Utils_Type
::T_INT
,
176 'title' => ts('Rule Length'),
177 'description' => ts('The length of the matching substring'),
178 'where' => 'civicrm_dedupe_rule.rule_length',
179 'table_name' => 'civicrm_dedupe_rule',
181 'bao' => 'CRM_Dedupe_BAO_Rule',
189 'name' => 'rule_weight',
190 'type' => CRM_Utils_Type
::T_INT
,
191 'title' => ts('Order'),
192 'description' => ts('The weight of the rule'),
194 'where' => 'civicrm_dedupe_rule.rule_weight',
195 'table_name' => 'civicrm_dedupe_rule',
197 'bao' => 'CRM_Dedupe_BAO_Rule',
205 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
207 return Civi
::$statics[__CLASS__
]['fields'];
211 * Return a mapping from field-name to the corresponding key (as used in fields()).
214 * Array(string $name => string $uniqueName).
216 public static function &fieldKeys() {
217 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
218 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
220 return Civi
::$statics[__CLASS__
]['fieldKeys'];
224 * Returns the names of this table
228 public static function getTableName() {
229 return self
::$_tableName;
233 * Returns if this table needs to be logged
237 public function getLog() {
242 * Returns the list of fields that can be imported
244 * @param bool $prefix
248 public static function &import($prefix = FALSE) {
249 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'dedupe_rule', $prefix, []);
254 * Returns the list of fields that can be exported
256 * @param bool $prefix
260 public static function &export($prefix = FALSE) {
261 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'dedupe_rule', $prefix, []);
266 * Returns the list of indices
268 * @param bool $localize
272 public static function indices($localize = TRUE) {
274 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;