Merge pull request #8916 from cividesk/CRM-19256-4.7
[civicrm-core.git] / CRM / Case / DAO / CaseContact.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/CaseContact.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:81a99f6c6d9abe6d08efd359c015036c)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Case_DAO_CaseContact constructor.
39 */
40 class CRM_Case_DAO_CaseContact extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_case_contact';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 * Unique case-contact association id
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Case ID of case-contact association.
61 *
62 * @var int unsigned
63 */
64 public $case_id;
65 /**
66 * Contact ID of contact record given case belongs to.
67 *
68 * @var int unsigned
69 */
70 public $contact_id;
71 /**
72 * Class constructor.
73 */
74 function __construct() {
75 $this->__table = 'civicrm_case_contact';
76 parent::__construct();
77 }
78 /**
79 * Returns foreign keys and entity references.
80 *
81 * @return array
82 * [CRM_Core_Reference_Interface]
83 */
84 static function getReferenceColumns() {
85 if (!isset(Civi::$statics[__CLASS__]['links'])) {
86 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
87 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'case_id', 'civicrm_case', 'id');
88 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
89 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
90 }
91 return Civi::$statics[__CLASS__]['links'];
92 }
93 /**
94 * Returns all the column names of this table
95 *
96 * @return array
97 */
98 static function &fields() {
99 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
100 Civi::$statics[__CLASS__]['fields'] = array(
101 'id' => array(
102 'name' => 'id',
103 'type' => CRM_Utils_Type::T_INT,
104 'title' => ts('Case Contact ID') ,
105 'description' => 'Unique case-contact association id',
106 'required' => true,
107 ) ,
108 'case_id' => array(
109 'name' => 'case_id',
110 'type' => CRM_Utils_Type::T_INT,
111 'title' => ts('Case') ,
112 'description' => 'Case ID of case-contact association.',
113 'required' => true,
114 'FKClassName' => 'CRM_Case_DAO_Case',
115 ) ,
116 'contact_id' => array(
117 'name' => 'contact_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Contact ID') ,
120 'description' => 'Contact ID of contact record given case belongs to.',
121 'required' => true,
122 'FKClassName' => 'CRM_Contact_DAO_Contact',
123 'html' => array(
124 'type' => 'EntityRef',
125 ) ,
126 ) ,
127 );
128 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
129 }
130 return Civi::$statics[__CLASS__]['fields'];
131 }
132 /**
133 * Return a mapping from field-name to the corresponding key (as used in fields()).
134 *
135 * @return array
136 * Array(string $name => string $uniqueName).
137 */
138 static function &fieldKeys() {
139 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
140 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
141 }
142 return Civi::$statics[__CLASS__]['fieldKeys'];
143 }
144 /**
145 * Returns the names of this table
146 *
147 * @return string
148 */
149 static function getTableName() {
150 return self::$_tableName;
151 }
152 /**
153 * Returns if this table needs to be logged
154 *
155 * @return boolean
156 */
157 function getLog() {
158 return self::$_log;
159 }
160 /**
161 * Returns the list of fields that can be imported
162 *
163 * @param bool $prefix
164 *
165 * @return array
166 */
167 static function &import($prefix = false) {
168 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'case_contact', $prefix, array());
169 return $r;
170 }
171 /**
172 * Returns the list of fields that can be exported
173 *
174 * @param bool $prefix
175 *
176 * @return array
177 */
178 static function &export($prefix = false) {
179 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'case_contact', $prefix, array());
180 return $r;
181 }
182 }