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