Commit | Line | Data |
---|---|---|
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 | |
e380ee3b | 9 | * (GenCodeChecksum:4234ea5a60e2a053e2de768a10cb1488) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the GroupOrganization entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class 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 | * | |
34 | * @var int unsigned | |
35 | */ | |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * ID of the group | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $group_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * ID of the Organization Contact | |
47 | * | |
48 | * @var int unsigned | |
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, |
522a26c9 | 90 | 'table_name' => 'civicrm_group_organization', |
91 | 'entity' => 'GroupOrganization', | |
92 | 'bao' => 'CRM_Contact_BAO_GroupOrganization', | |
6a7e5e5d | 93 | 'localizable' => 0, |
c3fc2621 CW |
94 | ], |
95 | 'group_id' => [ | |
e501603b TO |
96 | 'name' => 'group_id', |
97 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 98 | 'title' => ts('Group'), |
215b423e | 99 | 'description' => ts('ID of the group'), |
c3fc2621 | 100 | 'required' => TRUE, |
522a26c9 | 101 | 'table_name' => 'civicrm_group_organization', |
102 | 'entity' => 'GroupOrganization', | |
103 | 'bao' => 'CRM_Contact_BAO_GroupOrganization', | |
6a7e5e5d | 104 | 'localizable' => 0, |
e501603b | 105 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 106 | 'html' => [ |
e501603b | 107 | 'type' => 'Select', |
c3fc2621 CW |
108 | ], |
109 | 'pseudoconstant' => [ | |
e501603b TO |
110 | 'table' => 'civicrm_group', |
111 | 'keyColumn' => 'id', | |
112 | 'labelColumn' => 'title', | |
c3fc2621 CW |
113 | ] |
114 | ], | |
115 | 'organization_id' => [ | |
e501603b TO |
116 | 'name' => 'organization_id', |
117 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 118 | 'title' => ts('Organization'), |
215b423e | 119 | 'description' => ts('ID of the Organization Contact'), |
c3fc2621 | 120 | 'required' => TRUE, |
522a26c9 | 121 | 'table_name' => 'civicrm_group_organization', |
122 | 'entity' => 'GroupOrganization', | |
123 | 'bao' => 'CRM_Contact_BAO_GroupOrganization', | |
6a7e5e5d | 124 | 'localizable' => 0, |
e501603b | 125 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
c3fc2621 CW |
126 | ], |
127 | ]; | |
346aaaba | 128 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 129 | } |
346aaaba | 130 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 131 | } |
c3fc2621 | 132 | |
e501603b | 133 | /** |
bd8e0b14 | 134 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
135 | * |
136 | * @return array | |
bd8e0b14 | 137 | * Array(string $name => string $uniqueName). |
e501603b | 138 | */ |
c3fc2621 | 139 | public static function &fieldKeys() { |
bd8e0b14 TO |
140 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
141 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 142 | } |
bd8e0b14 | 143 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 144 | } |
c3fc2621 | 145 | |
e501603b TO |
146 | /** |
147 | * Returns the names of this table | |
148 | * | |
149 | * @return string | |
150 | */ | |
c3fc2621 | 151 | public static function getTableName() { |
e501603b TO |
152 | return self::$_tableName; |
153 | } | |
c3fc2621 | 154 | |
e501603b TO |
155 | /** |
156 | * Returns if this table needs to be logged | |
157 | * | |
c3fc2621 | 158 | * @return bool |
e501603b | 159 | */ |
c3fc2621 | 160 | public function getLog() { |
e501603b TO |
161 | return self::$_log; |
162 | } | |
c3fc2621 | 163 | |
e501603b TO |
164 | /** |
165 | * Returns the list of fields that can be imported | |
166 | * | |
167 | * @param bool $prefix | |
168 | * | |
169 | * @return array | |
170 | */ | |
c3fc2621 CW |
171 | public static function &import($prefix = FALSE) { |
172 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_organization', $prefix, []); | |
60808919 | 173 | return $r; |
e501603b | 174 | } |
c3fc2621 | 175 | |
e501603b TO |
176 | /** |
177 | * Returns the list of fields that can be exported | |
178 | * | |
179 | * @param bool $prefix | |
180 | * | |
181 | * @return array | |
182 | */ | |
c3fc2621 CW |
183 | public static function &export($prefix = FALSE) { |
184 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_organization', $prefix, []); | |
60808919 | 185 | return $r; |
e501603b | 186 | } |
c3fc2621 | 187 | |
e7a6b91a AS |
188 | /** |
189 | * Returns the list of indices | |
c3fc2621 CW |
190 | * |
191 | * @param bool $localize | |
192 | * | |
193 | * @return array | |
e7a6b91a AS |
194 | */ |
195 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
196 | $indices = [ |
197 | 'UI_group_organization' => [ | |
e7a6b91a | 198 | 'name' => 'UI_group_organization', |
c3fc2621 | 199 | 'field' => [ |
e7a6b91a AS |
200 | 0 => 'group_id', |
201 | 1 => 'organization_id', | |
c3fc2621 CW |
202 | ], |
203 | 'localizable' => FALSE, | |
204 | 'unique' => TRUE, | |
e7a6b91a | 205 | 'sig' => 'civicrm_group_organization::1::group_id::organization_id', |
c3fc2621 CW |
206 | ], |
207 | ]; | |
e7a6b91a AS |
208 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
209 | } | |
c3fc2621 | 210 | |
e501603b | 211 | } |