5 * @copyright CiviCRM LLC (c) 2004-2018
7 * Generated from xml/schema/CRM/Case/Case.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a9960d56bc697d6cbc5347f9bc6a78bc)
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 static $_tableName = 'civicrm_case';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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',
138 'headerPattern' => '',
141 'table_name' => 'civicrm_case',
143 'bao' => 'CRM_Case_BAO_Case',
147 'name' => 'case_type_id',
148 'type' => CRM_Utils_Type
::T_INT
,
149 'title' => ts('Case Type'),
150 'description' => ts('FK to civicrm_case_type.id'),
153 'where' => 'civicrm_case.case_type_id',
154 'headerPattern' => '',
157 'table_name' => 'civicrm_case',
159 'bao' => 'CRM_Case_BAO_Case',
161 'FKClassName' => 'CRM_Case_DAO_CaseType',
165 'pseudoconstant' => [
166 'table' => 'civicrm_case_type',
168 'labelColumn' => 'title',
173 'type' => CRM_Utils_Type
::T_STRING
,
174 'title' => ts('Case Subject'),
175 'description' => ts('Short name of the case.'),
177 'size' => CRM_Utils_Type
::HUGE
,
179 'where' => 'civicrm_case.subject',
180 'headerPattern' => '',
183 'table_name' => 'civicrm_case',
185 'bao' => 'CRM_Case_BAO_Case',
191 'case_start_date' => [
192 'name' => 'start_date',
193 'type' => CRM_Utils_Type
::T_DATE
,
194 'title' => ts('Case Start Date'),
195 'description' => ts('Date on which given case starts.'),
197 'where' => 'civicrm_case.start_date',
198 'headerPattern' => '',
201 'table_name' => 'civicrm_case',
203 'bao' => 'CRM_Case_BAO_Case',
206 'type' => 'Select Date',
207 'formatType' => 'activityDateTime',
211 'name' => 'end_date',
212 'type' => CRM_Utils_Type
::T_DATE
,
213 'title' => ts('Case End Date'),
214 'description' => ts('Date on which given case ends.'),
216 'where' => 'civicrm_case.end_date',
217 'headerPattern' => '',
220 'table_name' => 'civicrm_case',
222 'bao' => 'CRM_Case_BAO_Case',
225 'type' => 'Select Date',
226 'formatType' => 'activityDateTime',
231 'type' => CRM_Utils_Type
::T_TEXT
,
232 'title' => ts('Details'),
233 'description' => ts('Details about the meeting (agenda, notes, etc).'),
236 'table_name' => 'civicrm_case',
238 'bao' => 'CRM_Case_BAO_Case',
241 'type' => 'TextArea',
244 'case_status_id' => [
245 'name' => 'status_id',
246 'type' => CRM_Utils_Type
::T_INT
,
247 'title' => ts('Case Status'),
248 'description' => ts('Id of case status.'),
251 'where' => 'civicrm_case.status_id',
252 'headerPattern' => '',
255 'table_name' => 'civicrm_case',
257 'bao' => 'CRM_Case_BAO_Case',
262 'pseudoconstant' => [
263 'optionGroupName' => 'case_status',
264 'optionEditPath' => 'civicrm/admin/options/case_status',
268 'name' => 'is_deleted',
269 'type' => CRM_Utils_Type
::T_BOOLEAN
,
270 'title' => ts('Case is in the Trash'),
272 'where' => 'civicrm_case.is_deleted',
273 'headerPattern' => '',
277 'table_name' => 'civicrm_case',
279 'bao' => 'CRM_Case_BAO_Case',
282 'case_created_date' => [
283 'name' => 'created_date',
284 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
285 'title' => ts('Created Date'),
286 'description' => ts('When was the case was created.'),
289 'where' => 'civicrm_case.created_date',
290 'headerPattern' => '',
293 'table_name' => 'civicrm_case',
295 'bao' => 'CRM_Case_BAO_Case',
298 'case_modified_date' => [
299 'name' => 'modified_date',
300 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
301 'title' => ts('Modified Date'),
302 'description' => ts('When was the case (or closely related entity) was created or modified or deleted.'),
305 'where' => 'civicrm_case.modified_date',
306 'headerPattern' => '',
308 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
309 'table_name' => 'civicrm_case',
311 'bao' => 'CRM_Case_BAO_Case',
315 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
317 return Civi
::$statics[__CLASS__
]['fields'];
321 * Return a mapping from field-name to the corresponding key (as used in fields()).
324 * Array(string $name => string $uniqueName).
326 public static function &fieldKeys() {
327 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
328 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
330 return Civi
::$statics[__CLASS__
]['fieldKeys'];
334 * Returns the names of this table
338 public static function getTableName() {
339 return self
::$_tableName;
343 * Returns if this table needs to be logged
347 public function getLog() {
352 * Returns the list of fields that can be imported
354 * @param bool $prefix
358 public static function &import($prefix = FALSE) {
359 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'case', $prefix, []);
364 * Returns the list of fields that can be exported
366 * @param bool $prefix
370 public static function &export($prefix = FALSE) {
371 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'case', $prefix, []);
376 * Returns the list of indices
378 * @param bool $localize
382 public static function indices($localize = TRUE) {
384 'index_case_type_id' => [
385 'name' => 'index_case_type_id',
389 'localizable' => FALSE,
390 'sig' => 'civicrm_case::0::case_type_id',
392 'index_is_deleted' => [
393 'name' => 'index_is_deleted',
397 'localizable' => FALSE,
398 'sig' => 'civicrm_case::0::is_deleted',
401 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;