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 instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
90 * id of the first contact
96 * id of the second contact
100 public $contact_id_b;
102 * id of the relationship
106 public $relationship_type_id;
108 * date when the relationship started
114 * date when the relationship ended
120 * is the relationship active ?
126 * Optional verbose description for the relationship.
132 * is contact a has permission to view / edit contact and
133 related data for contact b ?
137 public $is_permission_a_b;
139 * is contact b has permission to view / edit contact and
140 related data for contact a ?
144 public $is_permission_b_a;
154 * @return civicrm_relationship
156 function __construct() {
157 $this->__table
= 'civicrm_relationship';
158 parent
::__construct();
161 * Returns foreign keys and entity references
164 * [CRM_Core_Reference_Interface]
166 static function getReferenceColumns() {
167 if (!self
::$_links) {
168 self
::$_links = static ::createReferenceColumns(__CLASS__
);
169 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id_a', 'civicrm_contact', 'id');
170 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'contact_id_b', 'civicrm_contact', 'id');
171 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'relationship_type_id', 'civicrm_relationship_type', 'id');
172 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'case_id', 'civicrm_case', 'id');
174 return self
::$_links;
177 * Returns all the column names of this table
181 static function &fields() {
182 if (!(self
::$_fields)) {
183 self
::$_fields = array(
186 'type' => CRM_Utils_Type
::T_INT
,
187 'title' => ts('Relationship ID') ,
188 'description' => 'Relationship ID',
191 'contact_id_a' => array(
192 'name' => 'contact_id_a',
193 'type' => CRM_Utils_Type
::T_INT
,
194 'title' => ts('Contact A') ,
195 'description' => 'id of the first contact',
197 'FKClassName' => 'CRM_Contact_DAO_Contact',
199 'contact_id_b' => array(
200 'name' => 'contact_id_b',
201 'type' => CRM_Utils_Type
::T_INT
,
202 'title' => ts('Contact B') ,
203 'description' => 'id of the second contact',
205 'FKClassName' => 'CRM_Contact_DAO_Contact',
207 'type' => 'EntityRef',
210 'relationship_type_id' => array(
211 'name' => 'relationship_type_id',
212 'type' => CRM_Utils_Type
::T_INT
,
213 'title' => ts('Relationship Type') ,
214 'description' => 'id of the relationship',
216 'FKClassName' => 'CRM_Contact_DAO_RelationshipType',
221 'start_date' => array(
222 'name' => 'start_date',
223 'type' => CRM_Utils_Type
::T_DATE
,
224 'title' => ts('Relationship Start Date') ,
225 'description' => 'date when the relationship started',
227 'type' => 'Select Date',
231 'name' => 'end_date',
232 'type' => CRM_Utils_Type
::T_DATE
,
233 'title' => ts('Relationship End Date') ,
234 'description' => 'date when the relationship ended',
236 'type' => 'Select Date',
239 'is_active' => array(
240 'name' => 'is_active',
241 'type' => CRM_Utils_Type
::T_BOOLEAN
,
242 'title' => ts('Relationship Is Active') ,
243 'description' => 'is the relationship active ?',
246 'type' => 'CheckBox',
249 'description' => array(
250 'name' => 'description',
251 'type' => CRM_Utils_Type
::T_STRING
,
252 'title' => ts('Relationship Description') ,
253 'description' => 'Optional verbose description for the relationship.',
255 'size' => CRM_Utils_Type
::HUGE
,
260 'is_permission_a_b' => array(
261 'name' => 'is_permission_a_b',
262 'type' => CRM_Utils_Type
::T_BOOLEAN
,
263 'title' => ts('Contact A has Permission Over Contact B') ,
264 'description' => 'is contact a has permission to view / edit contact and
265 related data for contact b ?
268 'type' => 'CheckBox',
271 'is_permission_b_a' => array(
272 'name' => 'is_permission_b_a',
273 'type' => CRM_Utils_Type
::T_BOOLEAN
,
274 'title' => ts('Contact B has Permission Over Contact A') ,
275 'description' => 'is contact b has permission to view / edit contact and
276 related data for contact a ?
279 'type' => 'CheckBox',
284 'type' => CRM_Utils_Type
::T_INT
,
285 'title' => ts('Relationship Case') ,
286 'description' => 'FK to civicrm_case',
288 'FKClassName' => 'CRM_Case_DAO_Case',
292 return self
::$_fields;
295 * Returns an array containing, for each field, the arary key used for that
296 * field in self::$_fields.
300 static function &fieldKeys() {
301 if (!(self
::$_fieldKeys)) {
302 self
::$_fieldKeys = array(
304 'contact_id_a' => 'contact_id_a',
305 'contact_id_b' => 'contact_id_b',
306 'relationship_type_id' => 'relationship_type_id',
307 'start_date' => 'start_date',
308 'end_date' => 'end_date',
309 'is_active' => 'is_active',
310 'description' => 'description',
311 'is_permission_a_b' => 'is_permission_a_b',
312 'is_permission_b_a' => 'is_permission_b_a',
313 'case_id' => 'case_id',
316 return self
::$_fieldKeys;
319 * Returns the names of this table
323 static function getTableName() {
324 return self
::$_tableName;
327 * Returns if this table needs to be logged
335 * Returns the list of fields that can be imported
337 * @param bool $prefix
341 static function &import($prefix = false) {
342 if (!(self
::$_import)) {
343 self
::$_import = array();
344 $fields = self
::fields();
345 foreach($fields as $name => $field) {
346 if (CRM_Utils_Array
::value('import', $field)) {
348 self
::$_import['relationship'] = & $fields[$name];
350 self
::$_import[$name] = & $fields[$name];
355 return self
::$_import;
358 * Returns the list of fields that can be exported
360 * @param bool $prefix
364 static function &export($prefix = false) {
365 if (!(self
::$_export)) {
366 self
::$_export = array();
367 $fields = self
::fields();
368 foreach($fields as $name => $field) {
369 if (CRM_Utils_Array
::value('export', $field)) {
371 self
::$_export['relationship'] = & $fields[$name];
373 self
::$_export[$name] = & $fields[$name];
378 return self
::$_export;