3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2017
31 * Generated from xml/schema/CRM/Contact/Relationship.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:a5a833da9d5016f0aeb06ba7c1058b3c)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Contact_DAO_Relationship constructor.
40 class CRM_Contact_DAO_Relationship
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_relationship';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * id of the first contact
66 * id of the second contact
72 * id of the relationship
76 public $relationship_type_id;
78 * date when the relationship started
84 * date when the relationship ended
90 * is the relationship active ?
96 * Optional verbose description for the relationship.
102 * is contact a has permission to view / edit contact and
103 related data for contact b ?
107 public $is_permission_a_b;
109 * is contact b has permission to view / edit contact and
110 related data for contact a ?
114 public $is_permission_b_a;
124 function __construct() {
125 $this->__table
= 'civicrm_relationship';
126 parent
::__construct();
129 * Returns foreign keys and entity references.
132 * [CRM_Core_Reference_Interface]
134 static function getReferenceColumns() {
135 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
136 Civi
::$statics[__CLASS__
]['links'] = static ::createReferenceColumns(__CLASS__
);
137 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id_a', 'civicrm_contact', 'id');
138 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id_b', 'civicrm_contact', 'id');
139 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id');
140 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName() , 'case_id', 'civicrm_case', 'id');
141 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
143 return Civi
::$statics[__CLASS__
]['links'];
146 * Returns all the column names of this table
150 static function &fields() {
151 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
152 Civi
::$statics[__CLASS__
]['fields'] = array(
155 'type' => CRM_Utils_Type
::T_INT
,
156 'title' => ts('Relationship ID') ,
157 'description' => 'Relationship ID',
159 'table_name' => 'civicrm_relationship',
160 'entity' => 'Relationship',
161 'bao' => 'CRM_Contact_BAO_Relationship',
164 'contact_id_a' => array(
165 'name' => 'contact_id_a',
166 'type' => CRM_Utils_Type
::T_INT
,
167 'title' => ts('Contact A') ,
168 'description' => 'id of the first contact',
170 'table_name' => 'civicrm_relationship',
171 'entity' => 'Relationship',
172 'bao' => 'CRM_Contact_BAO_Relationship',
174 'FKClassName' => 'CRM_Contact_DAO_Contact',
176 'contact_id_b' => array(
177 'name' => 'contact_id_b',
178 'type' => CRM_Utils_Type
::T_INT
,
179 'title' => ts('Contact B') ,
180 'description' => 'id of the second contact',
182 'table_name' => 'civicrm_relationship',
183 'entity' => 'Relationship',
184 'bao' => 'CRM_Contact_BAO_Relationship',
186 'FKClassName' => 'CRM_Contact_DAO_Contact',
188 'type' => 'EntityRef',
191 'relationship_type_id' => array(
192 'name' => 'relationship_type_id',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Relationship Type') ,
195 'description' => 'id of the relationship',
197 'table_name' => 'civicrm_relationship',
198 'entity' => 'Relationship',
199 'bao' => 'CRM_Contact_BAO_Relationship',
201 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
206 'start_date' => array(
207 'name' => 'start_date',
208 'type' => CRM_Utils_Type
::T_DATE
,
209 'title' => ts('Relationship Start Date') ,
210 'description' => 'date when the relationship started',
211 'table_name' => 'civicrm_relationship',
212 'entity' => 'Relationship',
213 'bao' => 'CRM_Contact_BAO_Relationship',
216 'type' => 'Select Date',
220 'name' => 'end_date',
221 'type' => CRM_Utils_Type
::T_DATE
,
222 'title' => ts('Relationship End Date') ,
223 'description' => 'date when the relationship ended',
224 'table_name' => 'civicrm_relationship',
225 'entity' => 'Relationship',
226 'bao' => 'CRM_Contact_BAO_Relationship',
229 'type' => 'Select Date',
232 'is_active' => array(
233 'name' => 'is_active',
234 'type' => CRM_Utils_Type
::T_BOOLEAN
,
235 'title' => ts('Relationship Is Active') ,
236 'description' => 'is the relationship active ?',
238 'table_name' => 'civicrm_relationship',
239 'entity' => 'Relationship',
240 'bao' => 'CRM_Contact_BAO_Relationship',
243 'type' => 'CheckBox',
246 'description' => array(
247 'name' => 'description',
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Relationship Description') ,
250 'description' => 'Optional verbose description for the relationship.',
252 'size' => CRM_Utils_Type
::HUGE
,
253 'table_name' => 'civicrm_relationship',
254 'entity' => 'Relationship',
255 'bao' => 'CRM_Contact_BAO_Relationship',
261 'is_permission_a_b' => array(
262 'name' => 'is_permission_a_b',
263 'type' => CRM_Utils_Type
::T_BOOLEAN
,
264 'title' => ts('Contact A has Permission Over Contact B') ,
265 'description' => 'is contact a has permission to view / edit contact and
266 related data for contact b ?
268 'table_name' => 'civicrm_relationship',
269 'entity' => 'Relationship',
270 'bao' => 'CRM_Contact_BAO_Relationship',
273 'type' => 'CheckBox',
276 'is_permission_b_a' => array(
277 'name' => 'is_permission_b_a',
278 'type' => CRM_Utils_Type
::T_BOOLEAN
,
279 'title' => ts('Contact B has Permission Over Contact A') ,
280 'description' => 'is contact b has permission to view / edit contact and
281 related data for contact a ?
283 'table_name' => 'civicrm_relationship',
284 'entity' => 'Relationship',
285 'bao' => 'CRM_Contact_BAO_Relationship',
288 'type' => 'CheckBox',
293 'type' => CRM_Utils_Type
::T_INT
,
294 'title' => ts('Relationship Case') ,
295 'description' => 'FK to civicrm_case',
297 'table_name' => 'civicrm_relationship',
298 'entity' => 'Relationship',
299 'bao' => 'CRM_Contact_BAO_Relationship',
301 'FKClassName' => 'CRM_Case_DAO_Case',
304 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
306 return Civi
::$statics[__CLASS__
]['fields'];
309 * Return a mapping from field-name to the corresponding key (as used in fields()).
312 * Array(string $name => string $uniqueName).
314 static function &fieldKeys() {
315 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
316 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
318 return Civi
::$statics[__CLASS__
]['fieldKeys'];
321 * Returns the names of this table
325 static function getTableName() {
326 return self
::$_tableName;
329 * Returns if this table needs to be logged
337 * Returns the list of fields that can be imported
339 * @param bool $prefix
343 static function &import($prefix = false) {
344 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship', $prefix, array());
348 * Returns the list of fields that can be exported
350 * @param bool $prefix
354 static function &export($prefix = false) {
355 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship', $prefix, array());