5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/GroupOrganization.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a16da367f856704d5432044055ed5d16)
13 * Database access object for the GroupOrganization entity.
15 class CRM_Contact_DAO_GroupOrganization
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.0';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_group_organization';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
48 * ID of the Organization Contact
52 public $organization_id;
57 public function __construct() {
58 $this->__table
= 'civicrm_group_organization';
59 parent
::__construct();
63 * Returns localized title of this entity.
66 * Whether to return the plural version of the title.
68 public static function getEntityTitle($plural = FALSE) {
69 return $plural ?
ts('Group Organizations') : ts('Group Organization');
73 * Returns foreign keys and entity references.
76 * [CRM_Core_Reference_Interface]
78 public static function getReferenceColumns() {
79 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
80 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
81 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'group_id', 'civicrm_group', 'id');
82 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'organization_id', 'civicrm_contact', 'id');
83 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
85 return Civi
::$statics[__CLASS__
]['links'];
89 * Returns all the column names of this table
93 public static function &fields() {
94 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
95 Civi
::$statics[__CLASS__
]['fields'] = [
98 'type' => CRM_Utils_Type
::T_INT
,
99 'title' => ts('Group Organization ID'),
100 'description' => ts('Relationship ID'),
102 'where' => 'civicrm_group_organization.id',
103 'table_name' => 'civicrm_group_organization',
104 'entity' => 'GroupOrganization',
105 'bao' => 'CRM_Contact_BAO_GroupOrganization',
110 'name' => 'group_id',
111 'type' => CRM_Utils_Type
::T_INT
,
112 'title' => ts('Group'),
113 'description' => ts('ID of the group'),
115 'where' => 'civicrm_group_organization.group_id',
116 'table_name' => 'civicrm_group_organization',
117 'entity' => 'GroupOrganization',
118 'bao' => 'CRM_Contact_BAO_GroupOrganization',
120 'FKClassName' => 'CRM_Contact_DAO_Group',
124 'pseudoconstant' => [
125 'table' => 'civicrm_group',
127 'labelColumn' => 'title',
131 'organization_id' => [
132 'name' => 'organization_id',
133 'type' => CRM_Utils_Type
::T_INT
,
134 'title' => ts('Organization'),
135 'description' => ts('ID of the Organization Contact'),
137 'where' => 'civicrm_group_organization.organization_id',
138 'table_name' => 'civicrm_group_organization',
139 'entity' => 'GroupOrganization',
140 'bao' => 'CRM_Contact_BAO_GroupOrganization',
142 'FKClassName' => 'CRM_Contact_DAO_Contact',
146 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
148 return Civi
::$statics[__CLASS__
]['fields'];
152 * Return a mapping from field-name to the corresponding key (as used in fields()).
155 * Array(string $name => string $uniqueName).
157 public static function &fieldKeys() {
158 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
159 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
161 return Civi
::$statics[__CLASS__
]['fieldKeys'];
165 * Returns the names of this table
169 public static function getTableName() {
170 return self
::$_tableName;
174 * Returns if this table needs to be logged
178 public function getLog() {
183 * Returns the list of fields that can be imported
185 * @param bool $prefix
189 public static function &import($prefix = FALSE) {
190 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_organization', $prefix, []);
195 * Returns the list of fields that can be exported
197 * @param bool $prefix
201 public static function &export($prefix = FALSE) {
202 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_organization', $prefix, []);
207 * Returns the list of indices
209 * @param bool $localize
213 public static function indices($localize = TRUE) {
215 'UI_group_organization' => [
216 'name' => 'UI_group_organization',
219 1 => 'organization_id',
221 'localizable' => FALSE,
223 'sig' => 'civicrm_group_organization::1::group_id::organization_id',
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;