Merge pull request #23707 from eileenmcnaughton/import_activity
[civicrm-core.git] / CRM / Dedupe / DAO / DedupeException.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Dedupe/DedupeException.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:b949a5127501b9db455542caf6b3ffa2)
10 */
11
12 /**
13 * Database access object for the DedupeException entity.
14 */
15 class CRM_Dedupe_DAO_DedupeException extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.3';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_dedupe_exception';
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 exception id
35 *
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * FK to Contact ID
44 *
45 * @var int|string
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $contact_id1;
50
51 /**
52 * FK to Contact ID
53 *
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $contact_id2;
59
60 /**
61 * Class constructor.
62 */
63 public function __construct() {
64 $this->__table = 'civicrm_dedupe_exception';
65 parent::__construct();
66 }
67
68 /**
69 * Returns localized title of this entity.
70 *
71 * @param bool $plural
72 * Whether to return the plural version of the title.
73 */
74 public static function getEntityTitle($plural = FALSE) {
75 return $plural ? ts('Dedupe Exceptions') : ts('Dedupe Exception');
76 }
77
78 /**
79 * Returns foreign keys and entity references.
80 *
81 * @return array
82 * [CRM_Core_Reference_Interface]
83 */
84 public static function getReferenceColumns() {
85 if (!isset(Civi::$statics[__CLASS__]['links'])) {
86 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
87 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id1', 'civicrm_contact', 'id');
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id2', 'civicrm_contact', 'id');
89 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
90 }
91 return Civi::$statics[__CLASS__]['links'];
92 }
93
94 /**
95 * Returns all the column names of this table
96 *
97 * @return array
98 */
99 public static function &fields() {
100 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
101 Civi::$statics[__CLASS__]['fields'] = [
102 'id' => [
103 'name' => 'id',
104 'type' => CRM_Utils_Type::T_INT,
105 'title' => ts('Dedupe Exception ID'),
106 'description' => ts('Unique dedupe exception id'),
107 'required' => TRUE,
108 'where' => 'civicrm_dedupe_exception.id',
109 'table_name' => 'civicrm_dedupe_exception',
110 'entity' => 'DedupeException',
111 'bao' => 'CRM_Dedupe_BAO_DedupeException',
112 'localizable' => 0,
113 'html' => [
114 'type' => 'Number',
115 ],
116 'readonly' => TRUE,
117 'add' => '3.3',
118 ],
119 'contact_id1' => [
120 'name' => 'contact_id1',
121 'type' => CRM_Utils_Type::T_INT,
122 'title' => ts('First Dupe Contact ID'),
123 'description' => ts('FK to Contact ID'),
124 'required' => TRUE,
125 'where' => 'civicrm_dedupe_exception.contact_id1',
126 'table_name' => 'civicrm_dedupe_exception',
127 'entity' => 'DedupeException',
128 'bao' => 'CRM_Dedupe_BAO_DedupeException',
129 'localizable' => 0,
130 'FKClassName' => 'CRM_Contact_DAO_Contact',
131 'html' => [
132 'label' => ts("First Dupe Contact"),
133 ],
134 'add' => '3.3',
135 ],
136 'contact_id2' => [
137 'name' => 'contact_id2',
138 'type' => CRM_Utils_Type::T_INT,
139 'title' => ts('Second Dupe Contact ID'),
140 'description' => ts('FK to Contact ID'),
141 'required' => TRUE,
142 'where' => 'civicrm_dedupe_exception.contact_id2',
143 'table_name' => 'civicrm_dedupe_exception',
144 'entity' => 'DedupeException',
145 'bao' => 'CRM_Dedupe_BAO_DedupeException',
146 'localizable' => 0,
147 'FKClassName' => 'CRM_Contact_DAO_Contact',
148 'html' => [
149 'label' => ts("Second Dupe Contact"),
150 ],
151 'add' => '3.3',
152 ],
153 ];
154 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
155 }
156 return Civi::$statics[__CLASS__]['fields'];
157 }
158
159 /**
160 * Return a mapping from field-name to the corresponding key (as used in fields()).
161 *
162 * @return array
163 * Array(string $name => string $uniqueName).
164 */
165 public static function &fieldKeys() {
166 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
167 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
168 }
169 return Civi::$statics[__CLASS__]['fieldKeys'];
170 }
171
172 /**
173 * Returns the names of this table
174 *
175 * @return string
176 */
177 public static function getTableName() {
178 return self::$_tableName;
179 }
180
181 /**
182 * Returns if this table needs to be logged
183 *
184 * @return bool
185 */
186 public function getLog() {
187 return self::$_log;
188 }
189
190 /**
191 * Returns the list of fields that can be imported
192 *
193 * @param bool $prefix
194 *
195 * @return array
196 */
197 public static function &import($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'dedupe_exception', $prefix, []);
199 return $r;
200 }
201
202 /**
203 * Returns the list of fields that can be exported
204 *
205 * @param bool $prefix
206 *
207 * @return array
208 */
209 public static function &export($prefix = FALSE) {
210 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'dedupe_exception', $prefix, []);
211 return $r;
212 }
213
214 /**
215 * Returns the list of indices
216 *
217 * @param bool $localize
218 *
219 * @return array
220 */
221 public static function indices($localize = TRUE) {
222 $indices = [
223 'UI_contact_id1_contact_id2' => [
224 'name' => 'UI_contact_id1_contact_id2',
225 'field' => [
226 0 => 'contact_id1',
227 1 => 'contact_id2',
228 ],
229 'localizable' => FALSE,
230 'unique' => TRUE,
231 'sig' => 'civicrm_dedupe_exception::1::contact_id1::contact_id2',
232 ],
233 ];
234 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
235 }
236
237 }