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:18934ada33c41380e719798d5f8550e8)
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',
114 'name' => 'group_id',
115 'type' => CRM_Utils_Type
::T_INT
,
116 'title' => ts('Group ID'),
117 'description' => ts('ID of the group'),
119 'where' => 'civicrm_group_organization.group_id',
120 'table_name' => 'civicrm_group_organization',
121 'entity' => 'GroupOrganization',
122 'bao' => 'CRM_Contact_BAO_GroupOrganization',
124 'FKClassName' => 'CRM_Contact_DAO_Group',
127 'label' => ts("Group"),
129 'pseudoconstant' => [
130 'table' => 'civicrm_group',
132 'labelColumn' => 'title',
136 'organization_id' => [
137 'name' => 'organization_id',
138 'type' => CRM_Utils_Type
::T_INT
,
139 'title' => ts('Organization ID'),
140 'description' => ts('ID of the Organization Contact'),
142 'where' => 'civicrm_group_organization.organization_id',
143 'table_name' => 'civicrm_group_organization',
144 'entity' => 'GroupOrganization',
145 'bao' => 'CRM_Contact_BAO_GroupOrganization',
147 'FKClassName' => 'CRM_Contact_DAO_Contact',
149 'label' => ts("Organization"),
154 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
156 return Civi
::$statics[__CLASS__
]['fields'];
160 * Return a mapping from field-name to the corresponding key (as used in fields()).
163 * Array(string $name => string $uniqueName).
165 public static function &fieldKeys() {
166 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
167 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
169 return Civi
::$statics[__CLASS__
]['fieldKeys'];
173 * Returns the names of this table
177 public static function getTableName() {
178 return self
::$_tableName;
182 * Returns if this table needs to be logged
186 public function getLog() {
191 * Returns the list of fields that can be imported
193 * @param bool $prefix
197 public static function &import($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'group_organization', $prefix, []);
203 * Returns the list of fields that can be exported
205 * @param bool $prefix
209 public static function &export($prefix = FALSE) {
210 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'group_organization', $prefix, []);
215 * Returns the list of indices
217 * @param bool $localize
221 public static function indices($localize = TRUE) {
223 'UI_group_organization' => [
224 'name' => 'UI_group_organization',
227 1 => 'organization_id',
229 'localizable' => FALSE,
231 'sig' => 'civicrm_group_organization::1::group_id::organization_id',
234 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;