Merge pull request #20556 from ixiam/dev#2642
[civicrm-core.git] / CRM / Case / DAO / CaseActivity.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Case/CaseActivity.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:e5c1c45fc5dc666a02a3c1e872ba9a2b)
10 */
11
12 /**
13 * Database access object for the CaseActivity entity.
14 */
15 class CRM_Case_DAO_CaseActivity extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.8';
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_activity';
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-activity association id
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * Case ID of case-activity association.
43 *
44 * @var int
45 */
46 public $case_id;
47
48 /**
49 * Activity ID of case-activity association.
50 *
51 * @var int
52 */
53 public $activity_id;
54
55 /**
56 * Class constructor.
57 */
58 public function __construct() {
59 $this->__table = 'civicrm_case_activity';
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 Activities') : ts('Case Activity');
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(), 'activity_id', 'civicrm_activity', '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 Activity ID'),
101 'description' => ts('Unique case-activity association id'),
102 'required' => TRUE,
103 'where' => 'civicrm_case_activity.id',
104 'table_name' => 'civicrm_case_activity',
105 'entity' => 'CaseActivity',
106 'bao' => 'CRM_Case_DAO_CaseActivity',
107 'localizable' => 0,
108 'html' => [
109 'type' => 'Number',
110 ],
111 'readonly' => TRUE,
112 'add' => '1.8',
113 ],
114 'case_id' => [
115 'name' => 'case_id',
116 'type' => CRM_Utils_Type::T_INT,
117 'title' => ts('Case ID'),
118 'description' => ts('Case ID of case-activity association.'),
119 'required' => TRUE,
120 'where' => 'civicrm_case_activity.case_id',
121 'table_name' => 'civicrm_case_activity',
122 'entity' => 'CaseActivity',
123 'bao' => 'CRM_Case_DAO_CaseActivity',
124 'localizable' => 0,
125 'FKClassName' => 'CRM_Case_DAO_Case',
126 'html' => [
127 'label' => ts("Case"),
128 ],
129 'add' => '1.8',
130 ],
131 'activity_id' => [
132 'name' => 'activity_id',
133 'type' => CRM_Utils_Type::T_INT,
134 'title' => ts('Activity ID'),
135 'description' => ts('Activity ID of case-activity association.'),
136 'required' => TRUE,
137 'where' => 'civicrm_case_activity.activity_id',
138 'table_name' => 'civicrm_case_activity',
139 'entity' => 'CaseActivity',
140 'bao' => 'CRM_Case_DAO_CaseActivity',
141 'localizable' => 0,
142 'FKClassName' => 'CRM_Activity_DAO_Activity',
143 'html' => [
144 'label' => ts("Activity"),
145 ],
146 'add' => '2.0',
147 ],
148 ];
149 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
150 }
151 return Civi::$statics[__CLASS__]['fields'];
152 }
153
154 /**
155 * Return a mapping from field-name to the corresponding key (as used in fields()).
156 *
157 * @return array
158 * Array(string $name => string $uniqueName).
159 */
160 public static function &fieldKeys() {
161 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
162 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
163 }
164 return Civi::$statics[__CLASS__]['fieldKeys'];
165 }
166
167 /**
168 * Returns the names of this table
169 *
170 * @return string
171 */
172 public static function getTableName() {
173 return self::$_tableName;
174 }
175
176 /**
177 * Returns if this table needs to be logged
178 *
179 * @return bool
180 */
181 public function getLog() {
182 return self::$_log;
183 }
184
185 /**
186 * Returns the list of fields that can be imported
187 *
188 * @param bool $prefix
189 *
190 * @return array
191 */
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_activity', $prefix, []);
194 return $r;
195 }
196
197 /**
198 * Returns the list of fields that can be exported
199 *
200 * @param bool $prefix
201 *
202 * @return array
203 */
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_activity', $prefix, []);
206 return $r;
207 }
208
209 /**
210 * Returns the list of indices
211 *
212 * @param bool $localize
213 *
214 * @return array
215 */
216 public static function indices($localize = TRUE) {
217 $indices = [
218 'UI_case_activity_id' => [
219 'name' => 'UI_case_activity_id',
220 'field' => [
221 0 => 'case_id',
222 1 => 'activity_id',
223 ],
224 'localizable' => FALSE,
225 'sig' => 'civicrm_case_activity::0::case_id::activity_id',
226 ],
227 ];
228 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
229 }
230
231 }