Regenerate DAO files
[civicrm-core.git] / CRM / Contact / DAO / GroupOrganization.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contact/GroupOrganization.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e6ca0a57 9 * (GenCodeChecksum:00717d9edb0719d380b5fd7c3e91bc74)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the GroupOrganization entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_GroupOrganization extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_group_organization';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = TRUE;
c3fc2621 30
e501603b
TO
31 /**
32 * Relationship ID
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * ID of the group
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $group_id;
c3fc2621 44
e501603b
TO
45 /**
46 * ID of the Organization Contact
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $organization_id;
c3fc2621 51
e501603b 52 /**
f41f0342 53 * Class constructor.
e501603b 54 */
c3fc2621 55 public function __construct() {
e501603b
TO
56 $this->__table = 'civicrm_group_organization';
57 parent::__construct();
58 }
c3fc2621 59
e501603b 60 /**
f41f0342 61 * Returns foreign keys and entity references.
e501603b
TO
62 *
63 * @return array
64 * [CRM_Core_Reference_Interface]
65 */
c3fc2621 66 public static function getReferenceColumns() {
346aaaba 67 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 68 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
69 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id');
70 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'organization_id', 'civicrm_contact', 'id');
346aaaba 71 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 72 }
346aaaba 73 return Civi::$statics[__CLASS__]['links'];
e501603b 74 }
c3fc2621 75
e501603b
TO
76 /**
77 * Returns all the column names of this table
78 *
79 * @return array
80 */
c3fc2621 81 public static function &fields() {
346aaaba 82 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
83 Civi::$statics[__CLASS__]['fields'] = [
84 'id' => [
e501603b
TO
85 'name' => 'id',
86 'type' => CRM_Utils_Type::T_INT,
c3fc2621 87 'title' => ts('Group Organization ID'),
215b423e 88 'description' => ts('Relationship ID'),
c3fc2621 89 'required' => TRUE,
a36434b9 90 'where' => 'civicrm_group_organization.id',
522a26c9 91 'table_name' => 'civicrm_group_organization',
92 'entity' => 'GroupOrganization',
93 'bao' => 'CRM_Contact_BAO_GroupOrganization',
6a7e5e5d 94 'localizable' => 0,
c3fc2621
CW
95 ],
96 'group_id' => [
e501603b
TO
97 'name' => 'group_id',
98 'type' => CRM_Utils_Type::T_INT,
c3fc2621 99 'title' => ts('Group'),
215b423e 100 'description' => ts('ID of the group'),
c3fc2621 101 'required' => TRUE,
a36434b9 102 'where' => 'civicrm_group_organization.group_id',
522a26c9 103 'table_name' => 'civicrm_group_organization',
104 'entity' => 'GroupOrganization',
105 'bao' => 'CRM_Contact_BAO_GroupOrganization',
6a7e5e5d 106 'localizable' => 0,
e501603b 107 'FKClassName' => 'CRM_Contact_DAO_Group',
c3fc2621 108 'html' => [
e501603b 109 'type' => 'Select',
c3fc2621
CW
110 ],
111 'pseudoconstant' => [
e501603b
TO
112 'table' => 'civicrm_group',
113 'keyColumn' => 'id',
114 'labelColumn' => 'title',
e6ca0a57 115 ],
c3fc2621
CW
116 ],
117 'organization_id' => [
e501603b
TO
118 'name' => 'organization_id',
119 'type' => CRM_Utils_Type::T_INT,
c3fc2621 120 'title' => ts('Organization'),
215b423e 121 'description' => ts('ID of the Organization Contact'),
c3fc2621 122 'required' => TRUE,
a36434b9 123 'where' => 'civicrm_group_organization.organization_id',
522a26c9 124 'table_name' => 'civicrm_group_organization',
125 'entity' => 'GroupOrganization',
126 'bao' => 'CRM_Contact_BAO_GroupOrganization',
6a7e5e5d 127 'localizable' => 0,
e501603b 128 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
129 ],
130 ];
346aaaba 131 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 132 }
346aaaba 133 return Civi::$statics[__CLASS__]['fields'];
e501603b 134 }
c3fc2621 135
e501603b 136 /**
bd8e0b14 137 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
138 *
139 * @return array
bd8e0b14 140 * Array(string $name => string $uniqueName).
e501603b 141 */
c3fc2621 142 public static function &fieldKeys() {
bd8e0b14
TO
143 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
144 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 145 }
bd8e0b14 146 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 147 }
c3fc2621 148
e501603b
TO
149 /**
150 * Returns the names of this table
151 *
152 * @return string
153 */
c3fc2621 154 public static function getTableName() {
e501603b
TO
155 return self::$_tableName;
156 }
c3fc2621 157
e501603b
TO
158 /**
159 * Returns if this table needs to be logged
160 *
c3fc2621 161 * @return bool
e501603b 162 */
c3fc2621 163 public function getLog() {
e501603b
TO
164 return self::$_log;
165 }
c3fc2621 166
e501603b
TO
167 /**
168 * Returns the list of fields that can be imported
169 *
170 * @param bool $prefix
171 *
172 * @return array
173 */
c3fc2621
CW
174 public static function &import($prefix = FALSE) {
175 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_organization', $prefix, []);
60808919 176 return $r;
e501603b 177 }
c3fc2621 178
e501603b
TO
179 /**
180 * Returns the list of fields that can be exported
181 *
182 * @param bool $prefix
183 *
184 * @return array
185 */
c3fc2621
CW
186 public static function &export($prefix = FALSE) {
187 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_organization', $prefix, []);
60808919 188 return $r;
e501603b 189 }
c3fc2621 190
e7a6b91a
AS
191 /**
192 * Returns the list of indices
c3fc2621
CW
193 *
194 * @param bool $localize
195 *
196 * @return array
e7a6b91a
AS
197 */
198 public static function indices($localize = TRUE) {
c3fc2621
CW
199 $indices = [
200 'UI_group_organization' => [
e7a6b91a 201 'name' => 'UI_group_organization',
c3fc2621 202 'field' => [
e7a6b91a
AS
203 0 => 'group_id',
204 1 => 'organization_id',
c3fc2621
CW
205 ],
206 'localizable' => FALSE,
207 'unique' => TRUE,
e7a6b91a 208 'sig' => 'civicrm_group_organization::1::group_id::organization_id',
c3fc2621
CW
209 ],
210 ];
e7a6b91a
AS
211 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
212 }
c3fc2621 213
e501603b 214}