Merge pull request #12001 from jitendrapurohit/core-64
[civicrm-core.git] / CRM / Case / DAO / CaseContact.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Case/CaseContact.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:def2443e49db4d131c39c07e2045fbb3)
10 */
11
12 /**
13 * Database access object for the CaseContact entity.
14 */
15 class CRM_Case_DAO_CaseContact extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_case_contact';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = TRUE;
30
31 /**
32 * Unique case-contact association id
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Case ID of case-contact association.
40 *
41 * @var int unsigned
42 */
43 public $case_id;
44
45 /**
46 * Contact ID of contact record given case belongs to.
47 *
48 * @var int unsigned
49 */
50 public $contact_id;
51
52 /**
53 * Class constructor.
54 */
55 public function __construct() {
56 $this->__table = 'civicrm_case_contact';
57 parent::__construct();
58 }
59
60 /**
61 * Returns foreign keys and entity references.
62 *
63 * @return array
64 * [CRM_Core_Reference_Interface]
65 */
66 public static function getReferenceColumns() {
67 if (!isset(Civi::$statics[__CLASS__]['links'])) {
68 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
69 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'case_id', 'civicrm_case', 'id');
70 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
71 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
72 }
73 return Civi::$statics[__CLASS__]['links'];
74 }
75
76 /**
77 * Returns all the column names of this table
78 *
79 * @return array
80 */
81 public static function &fields() {
82 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
83 Civi::$statics[__CLASS__]['fields'] = [
84 'id' => [
85 'name' => 'id',
86 'type' => CRM_Utils_Type::T_INT,
87 'title' => ts('Case Contact ID'),
88 'description' => 'Unique case-contact association id',
89 'required' => TRUE,
90 'table_name' => 'civicrm_case_contact',
91 'entity' => 'CaseContact',
92 'bao' => 'CRM_Case_BAO_CaseContact',
93 'localizable' => 0,
94 ],
95 'case_id' => [
96 'name' => 'case_id',
97 'type' => CRM_Utils_Type::T_INT,
98 'title' => ts('Case'),
99 'description' => 'Case ID of case-contact association.',
100 'required' => TRUE,
101 'table_name' => 'civicrm_case_contact',
102 'entity' => 'CaseContact',
103 'bao' => 'CRM_Case_BAO_CaseContact',
104 'localizable' => 0,
105 'FKClassName' => 'CRM_Case_DAO_Case',
106 ],
107 'contact_id' => [
108 'name' => 'contact_id',
109 'type' => CRM_Utils_Type::T_INT,
110 'title' => ts('Contact ID'),
111 'description' => 'Contact ID of contact record given case belongs to.',
112 'required' => TRUE,
113 'table_name' => 'civicrm_case_contact',
114 'entity' => 'CaseContact',
115 'bao' => 'CRM_Case_BAO_CaseContact',
116 'localizable' => 0,
117 'FKClassName' => 'CRM_Contact_DAO_Contact',
118 'html' => [
119 'type' => 'EntityRef',
120 ],
121 ],
122 ];
123 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
124 }
125 return Civi::$statics[__CLASS__]['fields'];
126 }
127
128 /**
129 * Return a mapping from field-name to the corresponding key (as used in fields()).
130 *
131 * @return array
132 * Array(string $name => string $uniqueName).
133 */
134 public static function &fieldKeys() {
135 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
136 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
137 }
138 return Civi::$statics[__CLASS__]['fieldKeys'];
139 }
140
141 /**
142 * Returns the names of this table
143 *
144 * @return string
145 */
146 public static function getTableName() {
147 return self::$_tableName;
148 }
149
150 /**
151 * Returns if this table needs to be logged
152 *
153 * @return bool
154 */
155 public function getLog() {
156 return self::$_log;
157 }
158
159 /**
160 * Returns the list of fields that can be imported
161 *
162 * @param bool $prefix
163 *
164 * @return array
165 */
166 public static function &import($prefix = FALSE) {
167 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, []);
168 return $r;
169 }
170
171 /**
172 * Returns the list of fields that can be exported
173 *
174 * @param bool $prefix
175 *
176 * @return array
177 */
178 public static function &export($prefix = FALSE) {
179 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, []);
180 return $r;
181 }
182
183 /**
184 * Returns the list of indices
185 *
186 * @param bool $localize
187 *
188 * @return array
189 */
190 public static function indices($localize = TRUE) {
191 $indices = [
192 'UI_case_contact_id' => [
193 'name' => 'UI_case_contact_id',
194 'field' => [
195 0 => 'case_id',
196 1 => 'contact_id',
197 ],
198 'localizable' => FALSE,
199 'unique' => TRUE,
200 'sig' => 'civicrm_case_contact::1::case_id::contact_id',
201 ],
202 ];
203 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
204 }
205
206 }