| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC (c) 2004-2019 |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Dedupe/RuleGroup.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:2e17168197c3a81d0280c153b668dc6e) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the RuleGroup entity. |
| 14 | */ |
| 15 | class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO { |
| 16 | |
| 17 | /** |
| 18 | * Static instance to hold the table name. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | public static $_tableName = 'civicrm_dedupe_rule_group'; |
| 23 | |
| 24 | /** |
| 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 26 | * |
| 27 | * @var bool |
| 28 | */ |
| 29 | public static $_log = FALSE; |
| 30 | |
| 31 | /** |
| 32 | * Unique dedupe rule group id |
| 33 | * |
| 34 | * @var int |
| 35 | */ |
| 36 | public $id; |
| 37 | |
| 38 | /** |
| 39 | * The type of contacts this group applies to |
| 40 | * |
| 41 | * @var string |
| 42 | */ |
| 43 | public $contact_type; |
| 44 | |
| 45 | /** |
| 46 | * The weight threshold the sum of the rule weights has to cross to consider two contacts the same |
| 47 | * |
| 48 | * @var int |
| 49 | */ |
| 50 | public $threshold; |
| 51 | |
| 52 | /** |
| 53 | * Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically) |
| 54 | * |
| 55 | * @var string |
| 56 | */ |
| 57 | public $used; |
| 58 | |
| 59 | /** |
| 60 | * Name of the rule group |
| 61 | * |
| 62 | * @var string |
| 63 | */ |
| 64 | public $name; |
| 65 | |
| 66 | /** |
| 67 | * Label of the rule group |
| 68 | * |
| 69 | * @var string |
| 70 | */ |
| 71 | public $title; |
| 72 | |
| 73 | /** |
| 74 | * Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin |
| 75 | * |
| 76 | * @var bool |
| 77 | */ |
| 78 | public $is_reserved; |
| 79 | |
| 80 | /** |
| 81 | * Class constructor. |
| 82 | */ |
| 83 | public function __construct() { |
| 84 | $this->__table = 'civicrm_dedupe_rule_group'; |
| 85 | parent::__construct(); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns all the column names of this table |
| 90 | * |
| 91 | * @return array |
| 92 | */ |
| 93 | public static function &fields() { |
| 94 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 95 | Civi::$statics[__CLASS__]['fields'] = [ |
| 96 | 'id' => [ |
| 97 | 'name' => 'id', |
| 98 | 'type' => CRM_Utils_Type::T_INT, |
| 99 | 'title' => ts('Rule Group ID'), |
| 100 | 'description' => ts('Unique dedupe rule group id'), |
| 101 | 'required' => TRUE, |
| 102 | 'where' => 'civicrm_dedupe_rule_group.id', |
| 103 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 104 | 'entity' => 'RuleGroup', |
| 105 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 106 | 'localizable' => 0, |
| 107 | ], |
| 108 | 'contact_type' => [ |
| 109 | 'name' => 'contact_type', |
| 110 | 'type' => CRM_Utils_Type::T_STRING, |
| 111 | 'title' => ts('Contact Type'), |
| 112 | 'description' => ts('The type of contacts this group applies to'), |
| 113 | 'maxlength' => 12, |
| 114 | 'size' => CRM_Utils_Type::TWELVE, |
| 115 | 'where' => 'civicrm_dedupe_rule_group.contact_type', |
| 116 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 117 | 'entity' => 'RuleGroup', |
| 118 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 119 | 'localizable' => 0, |
| 120 | 'html' => [ |
| 121 | 'type' => 'Select', |
| 122 | ], |
| 123 | 'pseudoconstant' => [ |
| 124 | 'table' => 'civicrm_contact_type', |
| 125 | 'keyColumn' => 'name', |
| 126 | 'labelColumn' => 'label', |
| 127 | 'condition' => 'parent_id IS NULL', |
| 128 | ], |
| 129 | ], |
| 130 | 'threshold' => [ |
| 131 | 'name' => 'threshold', |
| 132 | 'type' => CRM_Utils_Type::T_INT, |
| 133 | 'title' => ts('Threshold'), |
| 134 | 'description' => ts('The weight threshold the sum of the rule weights has to cross to consider two contacts the same'), |
| 135 | 'required' => TRUE, |
| 136 | 'where' => 'civicrm_dedupe_rule_group.threshold', |
| 137 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 138 | 'entity' => 'RuleGroup', |
| 139 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 140 | 'localizable' => 0, |
| 141 | 'html' => [ |
| 142 | 'type' => 'Text', |
| 143 | ], |
| 144 | ], |
| 145 | 'used' => [ |
| 146 | 'name' => 'used', |
| 147 | 'type' => CRM_Utils_Type::T_STRING, |
| 148 | 'title' => ts('Length'), |
| 149 | 'description' => ts('Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)'), |
| 150 | 'required' => TRUE, |
| 151 | 'maxlength' => 12, |
| 152 | 'size' => CRM_Utils_Type::TWELVE, |
| 153 | 'where' => 'civicrm_dedupe_rule_group.used', |
| 154 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 155 | 'entity' => 'RuleGroup', |
| 156 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 157 | 'localizable' => 0, |
| 158 | 'html' => [ |
| 159 | 'type' => 'Radio', |
| 160 | ], |
| 161 | 'pseudoconstant' => [ |
| 162 | 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', |
| 163 | ], |
| 164 | ], |
| 165 | 'name' => [ |
| 166 | 'name' => 'name', |
| 167 | 'type' => CRM_Utils_Type::T_STRING, |
| 168 | 'title' => ts('Name'), |
| 169 | 'description' => ts('Name of the rule group'), |
| 170 | 'maxlength' => 64, |
| 171 | 'size' => CRM_Utils_Type::BIG, |
| 172 | 'where' => 'civicrm_dedupe_rule_group.name', |
| 173 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 174 | 'entity' => 'RuleGroup', |
| 175 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 176 | 'localizable' => 0, |
| 177 | ], |
| 178 | 'title' => [ |
| 179 | 'name' => 'title', |
| 180 | 'type' => CRM_Utils_Type::T_STRING, |
| 181 | 'title' => ts('Title'), |
| 182 | 'description' => ts('Label of the rule group'), |
| 183 | 'maxlength' => 255, |
| 184 | 'size' => CRM_Utils_Type::HUGE, |
| 185 | 'where' => 'civicrm_dedupe_rule_group.title', |
| 186 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 187 | 'entity' => 'RuleGroup', |
| 188 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 189 | 'localizable' => 0, |
| 190 | 'html' => [ |
| 191 | 'type' => 'Text', |
| 192 | ], |
| 193 | ], |
| 194 | 'is_reserved' => [ |
| 195 | 'name' => 'is_reserved', |
| 196 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 197 | 'title' => ts('Reserved?'), |
| 198 | 'description' => ts('Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin'), |
| 199 | 'where' => 'civicrm_dedupe_rule_group.is_reserved', |
| 200 | 'table_name' => 'civicrm_dedupe_rule_group', |
| 201 | 'entity' => 'RuleGroup', |
| 202 | 'bao' => 'CRM_Dedupe_BAO_RuleGroup', |
| 203 | 'localizable' => 0, |
| 204 | 'html' => [ |
| 205 | 'type' => 'CheckBox', |
| 206 | ], |
| 207 | ], |
| 208 | ]; |
| 209 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 210 | } |
| 211 | return Civi::$statics[__CLASS__]['fields']; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 216 | * |
| 217 | * @return array |
| 218 | * Array(string $name => string $uniqueName). |
| 219 | */ |
| 220 | public static function &fieldKeys() { |
| 221 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
| 222 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); |
| 223 | } |
| 224 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * Returns the names of this table |
| 229 | * |
| 230 | * @return string |
| 231 | */ |
| 232 | public static function getTableName() { |
| 233 | return self::$_tableName; |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Returns if this table needs to be logged |
| 238 | * |
| 239 | * @return bool |
| 240 | */ |
| 241 | public function getLog() { |
| 242 | return self::$_log; |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * Returns the list of fields that can be imported |
| 247 | * |
| 248 | * @param bool $prefix |
| 249 | * |
| 250 | * @return array |
| 251 | */ |
| 252 | public static function &import($prefix = FALSE) { |
| 253 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule_group', $prefix, []); |
| 254 | return $r; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Returns the list of fields that can be exported |
| 259 | * |
| 260 | * @param bool $prefix |
| 261 | * |
| 262 | * @return array |
| 263 | */ |
| 264 | public static function &export($prefix = FALSE) { |
| 265 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule_group', $prefix, []); |
| 266 | return $r; |
| 267 | } |
| 268 | |
| 269 | /** |
| 270 | * Returns the list of indices |
| 271 | * |
| 272 | * @param bool $localize |
| 273 | * |
| 274 | * @return array |
| 275 | */ |
| 276 | public static function indices($localize = TRUE) { |
| 277 | $indices = []; |
| 278 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 279 | } |
| 280 | |
| 281 | } |