5 * @copyright CiviCRM LLC (c) 2004-2020
7 * Generated from xml/schema/CRM/Case/Case.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4fa22b57b48574c5e6643b13964140d4)
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 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
39 * FK to civicrm_case_type.id
46 * Short name of the case.
53 * Date on which given case starts.
60 * Date on which given case ends.
67 * Details about the meeting (agenda, notes, etc).
86 * When was the case was created.
93 * When was the case (or closely related entity) was created or modified or deleted.
97 public $modified_date;
102 public function __construct() {
103 $this->__table
= 'civicrm_case';
104 parent
::__construct();
108 * Returns foreign keys and entity references.
111 * [CRM_Core_Reference_Interface]
113 public static function getReferenceColumns() {
114 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
115 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
116 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'case_type_id', 'civicrm_case_type', 'id');
117 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
119 return Civi
::$statics[__CLASS__
]['links'];
123 * Returns all the column names of this table
127 public static function &fields() {
128 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
129 Civi
::$statics[__CLASS__
]['fields'] = [
132 'type' => CRM_Utils_Type
::T_INT
,
133 'title' => ts('Case ID'),
134 'description' => ts('Unique Case ID'),
137 'where' => 'civicrm_case.id',
139 'table_name' => 'civicrm_case',
141 'bao' => 'CRM_Case_BAO_Case',
148 'name' => 'case_type_id',
149 'type' => CRM_Utils_Type
::T_INT
,
150 'title' => ts('Case Type'),
151 'description' => ts('FK to civicrm_case_type.id'),
154 'where' => 'civicrm_case.case_type_id',
156 'table_name' => 'civicrm_case',
158 'bao' => 'CRM_Case_BAO_Case',
160 'FKClassName' => 'CRM_Case_DAO_CaseType',
164 'pseudoconstant' => [
165 'table' => 'civicrm_case_type',
167 'labelColumn' => 'title',
172 'type' => CRM_Utils_Type
::T_STRING
,
173 'title' => ts('Case Subject'),
174 'description' => ts('Short name of the case.'),
176 'size' => CRM_Utils_Type
::HUGE
,
178 'where' => 'civicrm_case.subject',
180 'table_name' => 'civicrm_case',
182 'bao' => 'CRM_Case_BAO_Case',
188 'case_start_date' => [
189 'name' => 'start_date',
190 'type' => CRM_Utils_Type
::T_DATE
,
191 'title' => ts('Case Start Date'),
192 'description' => ts('Date on which given case starts.'),
194 'where' => 'civicrm_case.start_date',
196 'table_name' => 'civicrm_case',
198 'bao' => 'CRM_Case_BAO_Case',
201 'type' => 'Select Date',
202 'formatType' => 'activityDateTime',
206 'name' => 'end_date',
207 'type' => CRM_Utils_Type
::T_DATE
,
208 'title' => ts('Case End Date'),
209 'description' => ts('Date on which given case ends.'),
211 'where' => 'civicrm_case.end_date',
213 'table_name' => 'civicrm_case',
215 'bao' => 'CRM_Case_BAO_Case',
218 'type' => 'Select Date',
219 'formatType' => 'activityDateTime',
224 'type' => CRM_Utils_Type
::T_TEXT
,
225 'title' => ts('Details'),
226 'description' => ts('Details about the meeting (agenda, notes, etc).'),
229 'where' => 'civicrm_case.details',
230 'table_name' => 'civicrm_case',
232 'bao' => 'CRM_Case_BAO_Case',
235 'type' => 'TextArea',
238 'case_status_id' => [
239 'name' => 'status_id',
240 'type' => CRM_Utils_Type
::T_INT
,
241 'title' => ts('Case Status'),
242 'description' => ts('Id of case status.'),
245 'where' => 'civicrm_case.status_id',
247 'table_name' => 'civicrm_case',
249 'bao' => 'CRM_Case_BAO_Case',
254 'pseudoconstant' => [
255 'optionGroupName' => 'case_status',
256 'optionEditPath' => 'civicrm/admin/options/case_status',
260 'name' => 'is_deleted',
261 'type' => CRM_Utils_Type
::T_BOOLEAN
,
262 'title' => ts('Case is in the Trash'),
264 'where' => 'civicrm_case.is_deleted',
267 'table_name' => 'civicrm_case',
269 'bao' => 'CRM_Case_BAO_Case',
272 'type' => 'CheckBox',
275 'case_created_date' => [
276 'name' => 'created_date',
277 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
278 'title' => ts('Created Date'),
279 'description' => ts('When was the case was created.'),
281 'where' => 'civicrm_case.created_date',
284 'table_name' => 'civicrm_case',
286 'bao' => 'CRM_Case_BAO_Case',
289 'case_modified_date' => [
290 'name' => 'modified_date',
291 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
292 'title' => ts('Modified Date'),
293 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'),
295 'where' => 'civicrm_case.modified_date',
297 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
298 'table_name' => 'civicrm_case',
300 'bao' => 'CRM_Case_BAO_Case',
304 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
306 return Civi
::$statics[__CLASS__
]['fields'];
310 * Return a mapping from field-name to the corresponding key (as used in fields()).
313 * Array(string $name => string $uniqueName).
315 public static function &fieldKeys() {
316 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
317 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
319 return Civi
::$statics[__CLASS__
]['fieldKeys'];
323 * Returns the names of this table
327 public static function getTableName() {
328 return self
::$_tableName;
332 * Returns if this table needs to be logged
336 public function getLog() {
341 * Returns the list of fields that can be imported
343 * @param bool $prefix
347 public static function &import($prefix = FALSE) {
348 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'case', $prefix, []);
353 * Returns the list of fields that can be exported
355 * @param bool $prefix
359 public static function &export($prefix = FALSE) {
360 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'case', $prefix, []);
365 * Returns the list of indices
367 * @param bool $localize
371 public static function indices($localize = TRUE) {
373 'index_case_type_id' => [
374 'name' => 'index_case_type_id',
378 'localizable' => FALSE,
379 'sig' => 'civicrm_case::0::case_type_id',
381 'index_is_deleted' => [
382 'name' => 'index_is_deleted',
386 'localizable' => FALSE,
387 'sig' => 'civicrm_case::0::is_deleted',
390 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;