| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Dedupe/Rule.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:682c730aac1fbf17f0cc2048e4b328f7) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the Rule entity. |
| 14 | */ |
| 15 | class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO { |
| 16 | const EXT = 'civicrm'; |
| 17 | const TABLE_ADDED = '1.8'; |
| 18 | |
| 19 | /** |
| 20 | * Static instance to hold the table name. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public static $_tableName = 'civicrm_dedupe_rule'; |
| 25 | |
| 26 | /** |
| 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 28 | * |
| 29 | * @var bool |
| 30 | */ |
| 31 | public static $_log = FALSE; |
| 32 | |
| 33 | /** |
| 34 | * Unique dedupe rule id |
| 35 | * |
| 36 | * @var int |
| 37 | */ |
| 38 | public $id; |
| 39 | |
| 40 | /** |
| 41 | * The id of the rule group this rule belongs to |
| 42 | * |
| 43 | * @var int |
| 44 | */ |
| 45 | public $dedupe_rule_group_id; |
| 46 | |
| 47 | /** |
| 48 | * The name of the table this rule is about |
| 49 | * |
| 50 | * @var string |
| 51 | */ |
| 52 | public $rule_table; |
| 53 | |
| 54 | /** |
| 55 | * The name of the field of the table referenced in rule_table |
| 56 | * |
| 57 | * @var string |
| 58 | */ |
| 59 | public $rule_field; |
| 60 | |
| 61 | /** |
| 62 | * The length of the matching substring |
| 63 | * |
| 64 | * @var int |
| 65 | */ |
| 66 | public $rule_length; |
| 67 | |
| 68 | /** |
| 69 | * The weight of the rule |
| 70 | * |
| 71 | * @var int |
| 72 | */ |
| 73 | public $rule_weight; |
| 74 | |
| 75 | /** |
| 76 | * Class constructor. |
| 77 | */ |
| 78 | public function __construct() { |
| 79 | $this->__table = 'civicrm_dedupe_rule'; |
| 80 | parent::__construct(); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Returns localized title of this entity. |
| 85 | * |
| 86 | * @param bool $plural |
| 87 | * Whether to return the plural version of the title. |
| 88 | */ |
| 89 | public static function getEntityTitle($plural = FALSE) { |
| 90 | return $plural ? ts('Rules') : ts('Rule'); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Returns foreign keys and entity references. |
| 95 | * |
| 96 | * @return array |
| 97 | * [CRM_Core_Reference_Interface] |
| 98 | */ |
| 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']); |
| 104 | } |
| 105 | return Civi::$statics[__CLASS__]['links']; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Returns all the column names of this table |
| 110 | * |
| 111 | * @return array |
| 112 | */ |
| 113 | public static function &fields() { |
| 114 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 115 | Civi::$statics[__CLASS__]['fields'] = [ |
| 116 | 'id' => [ |
| 117 | 'name' => 'id', |
| 118 | 'type' => CRM_Utils_Type::T_INT, |
| 119 | 'title' => ts('Dedupe Rule ID'), |
| 120 | 'description' => ts('Unique dedupe rule id'), |
| 121 | 'required' => TRUE, |
| 122 | 'where' => 'civicrm_dedupe_rule.id', |
| 123 | 'table_name' => 'civicrm_dedupe_rule', |
| 124 | 'entity' => 'Rule', |
| 125 | 'bao' => 'CRM_Dedupe_BAO_Rule', |
| 126 | 'localizable' => 0, |
| 127 | 'add' => '1.8', |
| 128 | ], |
| 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'), |
| 134 | 'required' => TRUE, |
| 135 | 'where' => 'civicrm_dedupe_rule.dedupe_rule_group_id', |
| 136 | 'table_name' => 'civicrm_dedupe_rule', |
| 137 | 'entity' => 'Rule', |
| 138 | 'bao' => 'CRM_Dedupe_BAO_Rule', |
| 139 | 'localizable' => 0, |
| 140 | 'FKClassName' => 'CRM_Dedupe_DAO_RuleGroup', |
| 141 | 'add' => '1.8', |
| 142 | ], |
| 143 | 'rule_table' => [ |
| 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'), |
| 148 | 'required' => TRUE, |
| 149 | 'maxlength' => 64, |
| 150 | 'size' => CRM_Utils_Type::BIG, |
| 151 | 'where' => 'civicrm_dedupe_rule.rule_table', |
| 152 | 'table_name' => 'civicrm_dedupe_rule', |
| 153 | 'entity' => 'Rule', |
| 154 | 'bao' => 'CRM_Dedupe_BAO_Rule', |
| 155 | 'localizable' => 0, |
| 156 | 'add' => '1.8', |
| 157 | ], |
| 158 | 'rule_field' => [ |
| 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'), |
| 163 | 'required' => TRUE, |
| 164 | 'maxlength' => 64, |
| 165 | 'size' => CRM_Utils_Type::BIG, |
| 166 | 'where' => 'civicrm_dedupe_rule.rule_field', |
| 167 | 'table_name' => 'civicrm_dedupe_rule', |
| 168 | 'entity' => 'Rule', |
| 169 | 'bao' => 'CRM_Dedupe_BAO_Rule', |
| 170 | 'localizable' => 0, |
| 171 | 'add' => '1.8', |
| 172 | ], |
| 173 | 'rule_length' => [ |
| 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', |
| 180 | 'entity' => 'Rule', |
| 181 | 'bao' => 'CRM_Dedupe_BAO_Rule', |
| 182 | 'localizable' => 0, |
| 183 | 'html' => [ |
| 184 | 'type' => 'Text', |
| 185 | ], |
| 186 | 'add' => '1.8', |
| 187 | ], |
| 188 | 'rule_weight' => [ |
| 189 | 'name' => 'rule_weight', |
| 190 | 'type' => CRM_Utils_Type::T_INT, |
| 191 | 'title' => ts('Order'), |
| 192 | 'description' => ts('The weight of the rule'), |
| 193 | 'required' => TRUE, |
| 194 | 'where' => 'civicrm_dedupe_rule.rule_weight', |
| 195 | 'table_name' => 'civicrm_dedupe_rule', |
| 196 | 'entity' => 'Rule', |
| 197 | 'bao' => 'CRM_Dedupe_BAO_Rule', |
| 198 | 'localizable' => 0, |
| 199 | 'html' => [ |
| 200 | 'type' => 'Text', |
| 201 | ], |
| 202 | 'add' => '1.8', |
| 203 | ], |
| 204 | ]; |
| 205 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 206 | } |
| 207 | return Civi::$statics[__CLASS__]['fields']; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 212 | * |
| 213 | * @return array |
| 214 | * Array(string $name => string $uniqueName). |
| 215 | */ |
| 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())); |
| 219 | } |
| 220 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Returns the names of this table |
| 225 | * |
| 226 | * @return string |
| 227 | */ |
| 228 | public static function getTableName() { |
| 229 | return self::$_tableName; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Returns if this table needs to be logged |
| 234 | * |
| 235 | * @return bool |
| 236 | */ |
| 237 | public function getLog() { |
| 238 | return self::$_log; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Returns the list of fields that can be imported |
| 243 | * |
| 244 | * @param bool $prefix |
| 245 | * |
| 246 | * @return array |
| 247 | */ |
| 248 | public static function &import($prefix = FALSE) { |
| 249 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_rule', $prefix, []); |
| 250 | return $r; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Returns the list of fields that can be exported |
| 255 | * |
| 256 | * @param bool $prefix |
| 257 | * |
| 258 | * @return array |
| 259 | */ |
| 260 | public static function &export($prefix = FALSE) { |
| 261 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_rule', $prefix, []); |
| 262 | return $r; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Returns the list of indices |
| 267 | * |
| 268 | * @param bool $localize |
| 269 | * |
| 270 | * @return array |
| 271 | */ |
| 272 | public static function indices($localize = TRUE) { |
| 273 | $indices = []; |
| 274 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 275 | } |
| 276 | |
| 277 | } |