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/RelationshipType.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:8fb00d8376af049ce62bc57ca01bc1bf)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
38 * CRM_Contact_DAO_RelationshipType constructor.
40 class CRM_Contact_DAO_RelationshipType
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 static $_tableName = 'civicrm_relationship_type';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
60 * name for relationship of contact_a to contact_b.
66 * label for relationship of contact_a to contact_b.
72 * Optional name for relationship of contact_b to contact_a.
78 * Optional label for relationship of contact_b to contact_a.
84 * Optional verbose description of the relationship type.
90 * If defined, contact_a in a relationship of this type must be a specific contact_type.
94 public $contact_type_a;
96 * If defined, contact_b in a relationship of this type must be a specific contact_type.
100 public $contact_type_b;
102 * If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
106 public $contact_sub_type_a;
108 * If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
112 public $contact_sub_type_b;
114 * Is this relationship type a predefined system type (can not be changed or de-activated)?
120 * Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
128 function __construct() {
129 $this->__table
= 'civicrm_relationship_type';
130 parent
::__construct();
133 * Returns all the column names of this table
137 static function &fields() {
138 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
139 Civi
::$statics[__CLASS__
]['fields'] = array(
142 'type' => CRM_Utils_Type
::T_INT
,
143 'title' => ts('Relationship Type ID') ,
144 'description' => 'Primary key',
146 'table_name' => 'civicrm_relationship_type',
147 'entity' => 'RelationshipType',
148 'bao' => 'CRM_Contact_BAO_RelationshipType',
152 'name' => 'name_a_b',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('Relationship Type Name A to B') ,
155 'description' => 'name for relationship of contact_a to contact_b.',
157 'size' => CRM_Utils_Type
::BIG
,
158 'table_name' => 'civicrm_relationship_type',
159 'entity' => 'RelationshipType',
160 'bao' => 'CRM_Contact_BAO_RelationshipType',
163 'label_a_b' => array(
164 'name' => 'label_a_b',
165 'type' => CRM_Utils_Type
::T_STRING
,
166 'title' => ts('Relationship Type Label A to B') ,
167 'description' => 'label for relationship of contact_a to contact_b.',
169 'size' => CRM_Utils_Type
::BIG
,
170 'table_name' => 'civicrm_relationship_type',
171 'entity' => 'RelationshipType',
172 'bao' => 'CRM_Contact_BAO_RelationshipType',
176 'name' => 'name_b_a',
177 'type' => CRM_Utils_Type
::T_STRING
,
178 'title' => ts('Relationship Type Name B to A') ,
179 'description' => 'Optional name for relationship of contact_b to contact_a.',
181 'size' => CRM_Utils_Type
::BIG
,
182 'table_name' => 'civicrm_relationship_type',
183 'entity' => 'RelationshipType',
184 'bao' => 'CRM_Contact_BAO_RelationshipType',
187 'label_b_a' => array(
188 'name' => 'label_b_a',
189 'type' => CRM_Utils_Type
::T_STRING
,
190 'title' => ts('Relationship Type Label B to A') ,
191 'description' => 'Optional label for relationship of contact_b to contact_a.',
193 'size' => CRM_Utils_Type
::BIG
,
194 'table_name' => 'civicrm_relationship_type',
195 'entity' => 'RelationshipType',
196 'bao' => 'CRM_Contact_BAO_RelationshipType',
199 'description' => array(
200 'name' => 'description',
201 'type' => CRM_Utils_Type
::T_STRING
,
202 'title' => ts('Relationship Description') ,
203 'description' => 'Optional verbose description of the relationship type.',
205 'size' => CRM_Utils_Type
::HUGE
,
206 'table_name' => 'civicrm_relationship_type',
207 'entity' => 'RelationshipType',
208 'bao' => 'CRM_Contact_BAO_RelationshipType',
211 'contact_type_a' => array(
212 'name' => 'contact_type_a',
213 'type' => CRM_Utils_Type
::T_STRING
,
214 'title' => ts('Contact Type for Contact A') ,
215 'description' => 'If defined, contact_a in a relationship of this type must be a specific contact_type.',
217 'size' => CRM_Utils_Type
::TWELVE
,
218 'table_name' => 'civicrm_relationship_type',
219 'entity' => 'RelationshipType',
220 'bao' => 'CRM_Contact_BAO_RelationshipType',
225 'pseudoconstant' => array(
226 'table' => 'civicrm_contact_type',
227 'keyColumn' => 'name',
228 'labelColumn' => 'label',
229 'condition' => 'parent_id IS NULL',
232 'contact_type_b' => array(
233 'name' => 'contact_type_b',
234 'type' => CRM_Utils_Type
::T_STRING
,
235 'title' => ts('Contact Type for Contact B') ,
236 'description' => 'If defined, contact_b in a relationship of this type must be a specific contact_type.',
238 'size' => CRM_Utils_Type
::TWELVE
,
239 'table_name' => 'civicrm_relationship_type',
240 'entity' => 'RelationshipType',
241 'bao' => 'CRM_Contact_BAO_RelationshipType',
246 'pseudoconstant' => array(
247 'table' => 'civicrm_contact_type',
248 'keyColumn' => 'name',
249 'labelColumn' => 'label',
250 'condition' => 'parent_id IS NULL',
253 'contact_sub_type_a' => array(
254 'name' => 'contact_sub_type_a',
255 'type' => CRM_Utils_Type
::T_STRING
,
256 'title' => ts('Contact Subtype A') ,
257 'description' => 'If defined, contact_sub_type_a in a relationship of this type must be a specific contact_sub_type.
260 'size' => CRM_Utils_Type
::BIG
,
261 'table_name' => 'civicrm_relationship_type',
262 'entity' => 'RelationshipType',
263 'bao' => 'CRM_Contact_BAO_RelationshipType',
268 'pseudoconstant' => array(
269 'table' => 'civicrm_contact_type',
270 'keyColumn' => 'name',
271 'labelColumn' => 'label',
272 'condition' => 'parent_id IS NOT NULL',
275 'contact_sub_type_b' => array(
276 'name' => 'contact_sub_type_b',
277 'type' => CRM_Utils_Type
::T_STRING
,
278 'title' => ts('Contact Subtype B') ,
279 'description' => 'If defined, contact_sub_type_b in a relationship of this type must be a specific contact_sub_type.
282 'size' => CRM_Utils_Type
::BIG
,
283 'table_name' => 'civicrm_relationship_type',
284 'entity' => 'RelationshipType',
285 'bao' => 'CRM_Contact_BAO_RelationshipType',
290 'pseudoconstant' => array(
291 'table' => 'civicrm_contact_type',
292 'keyColumn' => 'name',
293 'labelColumn' => 'label',
294 'condition' => 'parent_id IS NOT NULL',
297 'is_reserved' => array(
298 'name' => 'is_reserved',
299 'type' => CRM_Utils_Type
::T_BOOLEAN
,
300 'title' => ts('Relationship Type is Reserved') ,
301 'description' => 'Is this relationship type a predefined system type (can not be changed or de-activated)?',
302 'table_name' => 'civicrm_relationship_type',
303 'entity' => 'RelationshipType',
304 'bao' => 'CRM_Contact_BAO_RelationshipType',
307 'is_active' => array(
308 'name' => 'is_active',
309 'type' => CRM_Utils_Type
::T_BOOLEAN
,
310 'title' => ts('Relationship Type is Active') ,
311 'description' => 'Is this relationship type currently active (i.e. can be used when creating or editing relationships)?
314 'table_name' => 'civicrm_relationship_type',
315 'entity' => 'RelationshipType',
316 'bao' => 'CRM_Contact_BAO_RelationshipType',
320 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
322 return Civi
::$statics[__CLASS__
]['fields'];
325 * Return a mapping from field-name to the corresponding key (as used in fields()).
328 * Array(string $name => string $uniqueName).
330 static function &fieldKeys() {
331 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
332 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
334 return Civi
::$statics[__CLASS__
]['fieldKeys'];
337 * Returns the names of this table
341 static function getTableName() {
342 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
345 * Returns if this table needs to be logged
353 * Returns the list of fields that can be imported
355 * @param bool $prefix
359 static function &import($prefix = false) {
360 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'relationship_type', $prefix, array());
364 * Returns the list of fields that can be exported
366 * @param bool $prefix
370 static function &export($prefix = false) {
371 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'relationship_type', $prefix, array());
375 * Returns the list of indices
377 public static function indices($localize = TRUE) {
379 'UI_name_a_b' => array(
380 'name' => 'UI_name_a_b',
384 'localizable' => false,
386 'sig' => 'civicrm_relationship_type::1::name_a_b',
388 'UI_name_b_a' => array(
389 'name' => 'UI_name_b_a',
393 'localizable' => false,
395 'sig' => 'civicrm_relationship_type::1::name_b_a',
398 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;