5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Case/Case.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ec6804103883c17fff63061e06d3e591)
13 * Database access object for the Case entity.
15 class CRM_Case_DAO_Case
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_case';
25 * Icon associated with this entity.
29 public static $_icon = 'fa-folder-open';
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
36 public static $_log = TRUE;
46 * FK to civicrm_case_type.id
53 * Short name of the case.
60 * Date on which given case starts.
67 * Date on which given case ends.
74 * Details populated from Open Case. Only used in the CiviCase extension.
93 * When was the case was created.
100 * When was the case (or closely related entity) was created or modified or deleted.
104 public $modified_date;
109 public function __construct() {
110 $this->__table
= 'civicrm_case';
111 parent
::__construct();
115 * Returns localized title of this entity.
117 public static function getEntityTitle() {
122 * Returns foreign keys and entity references.
125 * [CRM_Core_Reference_Interface]
127 public static function getReferenceColumns() {
128 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
129 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
130 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'case_type_id', 'civicrm_case_type', 'id');
131 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
133 return Civi
::$statics[__CLASS__
]['links'];
137 * Returns all the column names of this table
141 public static function &fields() {
142 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
143 Civi
::$statics[__CLASS__
]['fields'] = [
146 'type' => CRM_Utils_Type
::T_INT
,
147 'title' => ts('Case ID'),
148 'description' => ts('Unique Case ID'),
151 'where' => 'civicrm_case.id',
153 'table_name' => 'civicrm_case',
155 'bao' => 'CRM_Case_BAO_Case',
163 'name' => 'case_type_id',
164 'type' => CRM_Utils_Type
::T_INT
,
165 'title' => ts('Case Type'),
166 'description' => ts('FK to civicrm_case_type.id'),
169 'where' => 'civicrm_case.case_type_id',
171 'table_name' => 'civicrm_case',
173 'bao' => 'CRM_Case_BAO_Case',
175 'FKClassName' => 'CRM_Case_DAO_CaseType',
179 'pseudoconstant' => [
180 'table' => 'civicrm_case_type',
182 'labelColumn' => 'title',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Case Subject'),
190 'description' => ts('Short name of the case.'),
192 'size' => CRM_Utils_Type
::HUGE
,
194 'where' => 'civicrm_case.subject',
196 'table_name' => 'civicrm_case',
198 'bao' => 'CRM_Case_BAO_Case',
205 'case_start_date' => [
206 'name' => 'start_date',
207 'type' => CRM_Utils_Type
::T_DATE
,
208 'title' => ts('Case Start Date'),
209 'description' => ts('Date on which given case starts.'),
211 'where' => 'civicrm_case.start_date',
213 'table_name' => 'civicrm_case',
215 'bao' => 'CRM_Case_BAO_Case',
218 'type' => 'Select Date',
219 'formatType' => 'activityDateTime',
224 'name' => 'end_date',
225 'type' => CRM_Utils_Type
::T_DATE
,
226 'title' => ts('Case End Date'),
227 'description' => ts('Date on which given case ends.'),
229 'where' => 'civicrm_case.end_date',
231 'table_name' => 'civicrm_case',
233 'bao' => 'CRM_Case_BAO_Case',
236 'type' => 'Select Date',
237 'formatType' => 'activityDateTime',
243 'type' => CRM_Utils_Type
::T_TEXT
,
244 'title' => ts('Details'),
245 'description' => ts('Details populated from Open Case. Only used in the CiviCase extension.'),
248 'where' => 'civicrm_case.details',
249 'table_name' => 'civicrm_case',
251 'bao' => 'CRM_Case_BAO_Case',
254 'type' => 'TextArea',
258 'case_status_id' => [
259 'name' => 'status_id',
260 'type' => CRM_Utils_Type
::T_INT
,
261 'title' => ts('Case Status'),
262 'description' => ts('Id of case status.'),
265 'where' => 'civicrm_case.status_id',
267 'table_name' => 'civicrm_case',
269 'bao' => 'CRM_Case_BAO_Case',
274 'pseudoconstant' => [
275 'optionGroupName' => 'case_status',
276 'optionEditPath' => 'civicrm/admin/options/case_status',
281 'name' => 'is_deleted',
282 'type' => CRM_Utils_Type
::T_BOOLEAN
,
283 'title' => ts('Case is in the Trash'),
285 'where' => 'civicrm_case.is_deleted',
288 'table_name' => 'civicrm_case',
290 'bao' => 'CRM_Case_BAO_Case',
293 'type' => 'CheckBox',
297 'case_created_date' => [
298 'name' => 'created_date',
299 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
300 'title' => ts('Created Date'),
301 'description' => ts('When was the case was created.'),
303 'where' => 'civicrm_case.created_date',
306 'table_name' => 'civicrm_case',
308 'bao' => 'CRM_Case_BAO_Case',
312 'case_modified_date' => [
313 'name' => 'modified_date',
314 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
315 'title' => ts('Modified Date'),
316 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'),
318 'where' => 'civicrm_case.modified_date',
320 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
321 'table_name' => 'civicrm_case',
323 'bao' => 'CRM_Case_BAO_Case',
328 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
330 return Civi
::$statics[__CLASS__
]['fields'];
334 * Return a mapping from field-name to the corresponding key (as used in fields()).
337 * Array(string $name => string $uniqueName).
339 public static function &fieldKeys() {
340 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
341 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
343 return Civi
::$statics[__CLASS__
]['fieldKeys'];
347 * Returns the names of this table
351 public static function getTableName() {
352 return self
::$_tableName;
356 * Returns if this table needs to be logged
360 public function getLog() {
365 * Returns the list of fields that can be imported
367 * @param bool $prefix
371 public static function &import($prefix = FALSE) {
372 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'case', $prefix, []);
377 * Returns the list of fields that can be exported
379 * @param bool $prefix
383 public static function &export($prefix = FALSE) {
384 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'case', $prefix, []);
389 * Returns the list of indices
391 * @param bool $localize
395 public static function indices($localize = TRUE) {
397 'index_case_type_id' => [
398 'name' => 'index_case_type_id',
402 'localizable' => FALSE,
403 'sig' => 'civicrm_case::0::case_type_id',
405 'index_is_deleted' => [
406 'name' => 'index_is_deleted',
410 'localizable' => FALSE,
411 'sig' => 'civicrm_case::0::is_deleted',
414 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;