Merge pull request #9596 from eileenmcnaughton/performance
[civicrm-core.git] / CRM / Case / DAO / Case.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/Case/Case.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:04bab9fc8d6e510321735d25c97ca261)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Case_DAO_Case extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_case';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = true;
51 /**
52 * Unique Case ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * FK to civicrm_case_type.id
59 *
60 * @var int unsigned
61 */
62 public $case_type_id;
63 /**
64 * Short name of the case.
65 *
66 * @var string
67 */
68 public $subject;
69 /**
70 * Date on which given case starts.
71 *
72 * @var date
73 */
74 public $start_date;
75 /**
76 * Date on which given case ends.
77 *
78 * @var date
79 */
80 public $end_date;
81 /**
82 * Details about the meeting (agenda, notes, etc).
83 *
84 * @var text
85 */
86 public $details;
87 /**
88 * Id of case status.
89 *
90 * @var int unsigned
91 */
92 public $status_id;
93 /**
94 *
95 * @var boolean
96 */
97 public $is_deleted;
98 /**
99 * class constructor
100 *
101 * @return civicrm_case
102 */
103 function __construct() {
104 $this->__table = 'civicrm_case';
105 parent::__construct();
106 }
107 /**
108 * Returns foreign keys and entity references
109 *
110 * @return array
111 * [CRM_Core_Reference_Interface]
112 */
113 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']);
118 }
119 return Civi::$statics[__CLASS__]['links'];
120 }
121 /**
122 * Returns all the column names of this table
123 *
124 * @return array
125 */
126 static function &fields() {
127 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
128 Civi::$statics[__CLASS__]['fields'] = array(
129 'case_id' => array(
130 'name' => 'id',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('Case ID') ,
133 'description' => 'Unique Case ID',
134 'required' => true,
135 'import' => true,
136 'where' => 'civicrm_case.id',
137 'headerPattern' => '',
138 'dataPattern' => '',
139 'export' => true,
140 ) ,
141 'case_type_id' => array(
142 'name' => 'case_type_id',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('Case Type') ,
145 'description' => 'FK to civicrm_case_type.id',
146 'import' => true,
147 'where' => 'civicrm_case.case_type_id',
148 'headerPattern' => '',
149 'dataPattern' => '',
150 'export' => false,
151 'FKClassName' => 'CRM_Case_DAO_CaseType',
152 'html' => array(
153 'type' => 'Select',
154 ) ,
155 'pseudoconstant' => array(
156 'table' => 'civicrm_case_type',
157 'keyColumn' => 'id',
158 'labelColumn' => 'title',
159 )
160 ) ,
161 'case_subject' => array(
162 'name' => 'subject',
163 'type' => CRM_Utils_Type::T_STRING,
164 'title' => ts('Case Subject') ,
165 'description' => 'Short name of the case.',
166 'maxlength' => 128,
167 'size' => CRM_Utils_Type::HUGE,
168 'import' => true,
169 'where' => 'civicrm_case.subject',
170 'headerPattern' => '',
171 'dataPattern' => '',
172 'export' => true,
173 'html' => array(
174 'type' => 'Text',
175 ) ,
176 ) ,
177 'case_start_date' => array(
178 'name' => 'start_date',
179 'type' => CRM_Utils_Type::T_DATE,
180 'title' => ts('Case Start Date') ,
181 'description' => 'Date on which given case starts.',
182 'import' => true,
183 'where' => 'civicrm_case.start_date',
184 'headerPattern' => '',
185 'dataPattern' => '',
186 'export' => true,
187 'html' => array(
188 'type' => 'Select Date',
189 ) ,
190 ) ,
191 'case_end_date' => array(
192 'name' => 'end_date',
193 'type' => CRM_Utils_Type::T_DATE,
194 'title' => ts('Case End Date') ,
195 'description' => 'Date on which given case ends.',
196 'import' => true,
197 'where' => 'civicrm_case.end_date',
198 'headerPattern' => '',
199 'dataPattern' => '',
200 'export' => true,
201 'html' => array(
202 'type' => 'Select Date',
203 ) ,
204 ) ,
205 'details' => array(
206 'name' => 'details',
207 'type' => CRM_Utils_Type::T_TEXT,
208 'title' => ts('Details') ,
209 'description' => 'Details about the meeting (agenda, notes, etc).',
210 'rows' => 8,
211 'cols' => 60,
212 'html' => array(
213 'type' => 'TextArea',
214 ) ,
215 ) ,
216 'case_status_id' => array(
217 'name' => 'status_id',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Case Status') ,
220 'description' => 'Id of case status.',
221 'required' => true,
222 'import' => true,
223 'where' => 'civicrm_case.status_id',
224 'headerPattern' => '',
225 'dataPattern' => '',
226 'export' => false,
227 'html' => array(
228 'type' => 'Select',
229 ) ,
230 'pseudoconstant' => array(
231 'optionGroupName' => 'case_status',
232 'optionEditPath' => 'civicrm/admin/options/case_status',
233 )
234 ) ,
235 'case_deleted' => array(
236 'name' => 'is_deleted',
237 'type' => CRM_Utils_Type::T_BOOLEAN,
238 'title' => ts('Case is in the Trash') ,
239 'import' => true,
240 'where' => 'civicrm_case.is_deleted',
241 'headerPattern' => '',
242 'dataPattern' => '',
243 'export' => true,
244 ) ,
245 );
246 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
247 }
248 return Civi::$statics[__CLASS__]['fields'];
249 }
250 /**
251 * Return a mapping from field-name to the corresponding key (as used in fields()).
252 *
253 * @return array
254 * Array(string $name => string $uniqueName).
255 */
256 static function &fieldKeys() {
257 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
258 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
259 }
260 return Civi::$statics[__CLASS__]['fieldKeys'];
261 }
262 /**
263 * Returns the names of this table
264 *
265 * @return string
266 */
267 static function getTableName() {
268 return self::$_tableName;
269 }
270 /**
271 * Returns if this table needs to be logged
272 *
273 * @return boolean
274 */
275 function getLog() {
276 return self::$_log;
277 }
278 /**
279 * Returns the list of fields that can be imported
280 *
281 * @param bool $prefix
282 *
283 * @return array
284 */
285 static function &import($prefix = false) {
286 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case', $prefix, array());
287 return $r;
288 }
289 /**
290 * Returns the list of fields that can be exported
291 *
292 * @param bool $prefix
293 *
294 * @return array
295 */
296 static function &export($prefix = false) {
297 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case', $prefix, array());
298 return $r;
299 }
300 }