3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
31 * Generated from xml/schema/CRM/Contact/Relationship.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:935010ec18927fdebfa19965f5f73b48)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Contact_DAO_Relationship
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_relationship';
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
58 * id of the first contact
64 * id of the second contact
70 * id of the relationship
74 public $relationship_type_id;
76 * date when the relationship started
82 * date when the relationship ended
88 * is the relationship active ?
94 * Optional verbose description for the relationship.
100 * is contact a has permission to view / edit contact and
101 related data for contact b ?
105 public $is_permission_a_b;
107 * is contact b has permission to view / edit contact and
108 related data for contact a ?
112 public $is_permission_b_a;
122 * @return civicrm_relationship
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',
160 'contact_id_a' => array(
161 'name' => 'contact_id_a',
162 'type' => CRM_Utils_Type
::T_INT
,
163 'title' => ts('Contact A') ,
164 'description' => 'id of the first contact',
166 'FKClassName' => 'CRM_Contact_DAO_Contact',
168 'contact_id_b' => array(
169 'name' => 'contact_id_b',
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Contact B') ,
172 'description' => 'id of the second contact',
174 'FKClassName' => 'CRM_Contact_DAO_Contact',
176 'type' => 'EntityRef',
179 'relationship_type_id' => array(
180 'name' => 'relationship_type_id',
181 'type' => CRM_Utils_Type
::T_INT
,
182 'title' => ts('Relationship Type') ,
183 'description' => 'id of the relationship',
185 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
190 'start_date' => array(
191 'name' => 'start_date',
192 'type' => CRM_Utils_Type
::T_DATE
,
193 'title' => ts('Relationship Start Date') ,
194 'description' => 'date when the relationship started',
196 'type' => 'Select Date',
200 'name' => 'end_date',
201 'type' => CRM_Utils_Type
::T_DATE
,
202 'title' => ts('Relationship End Date') ,
203 'description' => 'date when the relationship ended',
205 'type' => 'Select Date',
208 'is_active' => array(
209 'name' => 'is_active',
210 'type' => CRM_Utils_Type
::T_BOOLEAN
,
211 'title' => ts('Relationship Is Active') ,
212 'description' => 'is the relationship active ?',
215 'type' => 'CheckBox',
218 'description' => array(
219 'name' => 'description',
220 'type' => CRM_Utils_Type
::T_STRING
,
221 'title' => ts('Relationship Description') ,
222 'description' => 'Optional verbose description for the relationship.',
224 'size' => CRM_Utils_Type
::HUGE
,
229 'is_permission_a_b' => array(
230 'name' => 'is_permission_a_b',
231 'type' => CRM_Utils_Type
::T_BOOLEAN
,
232 'title' => ts('Contact A has Permission Over Contact B') ,
233 'description' => 'is contact a has permission to view / edit contact and
234 related data for contact b ?
237 'type' => 'CheckBox',
240 'is_permission_b_a' => array(
241 'name' => 'is_permission_b_a',
242 'type' => CRM_Utils_Type
::T_BOOLEAN
,
243 'title' => ts('Contact B has Permission Over Contact A') ,
244 'description' => 'is contact b has permission to view / edit contact and
245 related data for contact a ?
248 'type' => 'CheckBox',
253 'type' => CRM_Utils_Type
::T_INT
,
254 'title' => ts('Relationship Case') ,
255 'description' => 'FK to civicrm_case',
257 'FKClassName' => 'CRM_Case_DAO_Case',
260 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
262 return Civi
::$statics[__CLASS__
]['fields'];
265 * Return a mapping from field-name to the corresponding key (as used in fields()).
268 * Array(string $name => string $uniqueName).
270 static function &fieldKeys() {
271 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
272 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
274 return Civi
::$statics[__CLASS__
]['fieldKeys'];
277 * Returns the names of this table
281 static function getTableName() {
282 return self
::$_tableName;
285 * Returns if this table needs to be logged
293 * Returns the list of fields that can be imported
295 * @param bool $prefix
299 static function &import($prefix = false) {
300 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship', $prefix, array());
304 * Returns the list of fields that can be exported
306 * @param bool $prefix
310 static function &export($prefix = false) {
311 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship', $prefix, array());