Merge pull request #15435 from MegaphoneJon/reporting-21
[civicrm-core.git] / CRM / Contact / DAO / GroupOrganization.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contact/GroupOrganization.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a9d0587b 9 * (GenCodeChecksum:59e2d9b6cb5577d3f8a72422fb33f643)
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
449c4e6b
CW
60 /**
61 * Returns localized title of this entity.
62 */
63 public static function getEntityTitle() {
64 return ts('Group Organizations');
65 }
66
e501603b 67 /**
f41f0342 68 * Returns foreign keys and entity references.
e501603b
TO
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
c3fc2621 73 public static function getReferenceColumns() {
346aaaba 74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
76 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'organization_id', 'civicrm_contact', 'id');
346aaaba 78 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 79 }
346aaaba 80 return Civi::$statics[__CLASS__]['links'];
e501603b 81 }
c3fc2621 82
e501603b
TO
83 /**
84 * Returns all the column names of this table
85 *
86 * @return array
87 */
c3fc2621 88 public static function &fields() {
346aaaba 89 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
90 Civi::$statics[__CLASS__]['fields'] = [
91 'id' => [
e501603b
TO
92 'name' => 'id',
93 'type' => CRM_Utils_Type::T_INT,
c3fc2621 94 'title' => ts('Group Organization ID'),
215b423e 95 'description' => ts('Relationship ID'),
c3fc2621 96 'required' => TRUE,
a36434b9 97 'where' => 'civicrm_group_organization.id',
522a26c9 98 'table_name' => 'civicrm_group_organization',
99 'entity' => 'GroupOrganization',
100 'bao' => 'CRM_Contact_BAO_GroupOrganization',
6a7e5e5d 101 'localizable' => 0,
a9d0587b 102 'add' => '2.0',
c3fc2621
CW
103 ],
104 'group_id' => [
e501603b
TO
105 'name' => 'group_id',
106 'type' => CRM_Utils_Type::T_INT,
c3fc2621 107 'title' => ts('Group'),
215b423e 108 'description' => ts('ID of the group'),
c3fc2621 109 'required' => TRUE,
a36434b9 110 'where' => 'civicrm_group_organization.group_id',
522a26c9 111 'table_name' => 'civicrm_group_organization',
112 'entity' => 'GroupOrganization',
113 'bao' => 'CRM_Contact_BAO_GroupOrganization',
6a7e5e5d 114 'localizable' => 0,
e501603b 115 'FKClassName' => 'CRM_Contact_DAO_Group',
c3fc2621 116 'html' => [
e501603b 117 'type' => 'Select',
c3fc2621
CW
118 ],
119 'pseudoconstant' => [
e501603b
TO
120 'table' => 'civicrm_group',
121 'keyColumn' => 'id',
122 'labelColumn' => 'title',
e6ca0a57 123 ],
a9d0587b 124 'add' => '2.0',
c3fc2621
CW
125 ],
126 'organization_id' => [
e501603b
TO
127 'name' => 'organization_id',
128 'type' => CRM_Utils_Type::T_INT,
c3fc2621 129 'title' => ts('Organization'),
215b423e 130 'description' => ts('ID of the Organization Contact'),
c3fc2621 131 'required' => TRUE,
a36434b9 132 'where' => 'civicrm_group_organization.organization_id',
522a26c9 133 'table_name' => 'civicrm_group_organization',
134 'entity' => 'GroupOrganization',
135 'bao' => 'CRM_Contact_BAO_GroupOrganization',
6a7e5e5d 136 'localizable' => 0,
e501603b 137 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 138 'add' => '2.0',
c3fc2621
CW
139 ],
140 ];
346aaaba 141 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 142 }
346aaaba 143 return Civi::$statics[__CLASS__]['fields'];
e501603b 144 }
c3fc2621 145
e501603b 146 /**
bd8e0b14 147 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
148 *
149 * @return array
bd8e0b14 150 * Array(string $name => string $uniqueName).
e501603b 151 */
c3fc2621 152 public static function &fieldKeys() {
bd8e0b14
TO
153 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
154 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 155 }
bd8e0b14 156 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 157 }
c3fc2621 158
e501603b
TO
159 /**
160 * Returns the names of this table
161 *
162 * @return string
163 */
c3fc2621 164 public static function getTableName() {
e501603b
TO
165 return self::$_tableName;
166 }
c3fc2621 167
e501603b
TO
168 /**
169 * Returns if this table needs to be logged
170 *
c3fc2621 171 * @return bool
e501603b 172 */
c3fc2621 173 public function getLog() {
e501603b
TO
174 return self::$_log;
175 }
c3fc2621 176
e501603b
TO
177 /**
178 * Returns the list of fields that can be imported
179 *
180 * @param bool $prefix
181 *
182 * @return array
183 */
c3fc2621
CW
184 public static function &import($prefix = FALSE) {
185 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_organization', $prefix, []);
60808919 186 return $r;
e501603b 187 }
c3fc2621 188
e501603b
TO
189 /**
190 * Returns the list of fields that can be exported
191 *
192 * @param bool $prefix
193 *
194 * @return array
195 */
c3fc2621
CW
196 public static function &export($prefix = FALSE) {
197 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_organization', $prefix, []);
60808919 198 return $r;
e501603b 199 }
c3fc2621 200
e7a6b91a
AS
201 /**
202 * Returns the list of indices
c3fc2621
CW
203 *
204 * @param bool $localize
205 *
206 * @return array
e7a6b91a
AS
207 */
208 public static function indices($localize = TRUE) {
c3fc2621
CW
209 $indices = [
210 'UI_group_organization' => [
e7a6b91a 211 'name' => 'UI_group_organization',
c3fc2621 212 'field' => [
e7a6b91a
AS
213 0 => 'group_id',
214 1 => 'organization_id',
c3fc2621
CW
215 ],
216 'localizable' => FALSE,
217 'unique' => TRUE,
e7a6b91a 218 'sig' => 'civicrm_group_organization::1::group_id::organization_id',
c3fc2621
CW
219 ],
220 ];
e7a6b91a
AS
221 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
222 }
c3fc2621 223
e501603b 224}