Commit | Line | Data |
---|---|---|
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 | |
28979d65 | 9 | * (GenCodeChecksum:0058d88ce8ce0b5a017cfd91b1adc430) |
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 { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '2.0'; | |
c3fc2621 | 18 | |
e501603b | 19 | /** |
f41f0342 | 20 | * Static instance to hold the table name. |
e501603b TO |
21 | * |
22 | * @var string | |
23 | */ | |
fa45b5b9 | 24 | public static $_tableName = 'civicrm_group_organization'; |
c3fc2621 | 25 | |
e501603b | 26 | /** |
f41f0342 | 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 28 | * |
c3fc2621 | 29 | * @var bool |
e501603b | 30 | */ |
fa45b5b9 | 31 | public static $_log = TRUE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * Relationship ID | |
35 | * | |
28979d65 CW |
36 | * @var int|string|null |
37 | * (SQL type: int unsigned) | |
38 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
39 | */ |
40 | public $id; | |
c3fc2621 | 41 | |
e501603b TO |
42 | /** |
43 | * ID of the group | |
44 | * | |
28979d65 CW |
45 | * @var int|string |
46 | * (SQL type: int unsigned) | |
47 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
48 | */ |
49 | public $group_id; | |
c3fc2621 | 50 | |
e501603b TO |
51 | /** |
52 | * ID of the Organization Contact | |
53 | * | |
28979d65 CW |
54 | * @var int|string |
55 | * (SQL type: int unsigned) | |
56 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
57 | */ |
58 | public $organization_id; | |
c3fc2621 | 59 | |
e501603b | 60 | /** |
f41f0342 | 61 | * Class constructor. |
e501603b | 62 | */ |
c3fc2621 | 63 | public function __construct() { |
e501603b TO |
64 | $this->__table = 'civicrm_group_organization'; |
65 | parent::__construct(); | |
66 | } | |
c3fc2621 | 67 | |
449c4e6b CW |
68 | /** |
69 | * Returns localized title of this entity. | |
7b66c3b5 AH |
70 | * |
71 | * @param bool $plural | |
72 | * Whether to return the plural version of the title. | |
449c4e6b | 73 | */ |
7b66c3b5 AH |
74 | public static function getEntityTitle($plural = FALSE) { |
75 | return $plural ? ts('Group Organizations') : ts('Group Organization'); | |
449c4e6b CW |
76 | } |
77 | ||
e501603b | 78 | /** |
f41f0342 | 79 | * Returns foreign keys and entity references. |
e501603b TO |
80 | * |
81 | * @return array | |
82 | * [CRM_Core_Reference_Interface] | |
83 | */ | |
c3fc2621 | 84 | public static function getReferenceColumns() { |
346aaaba | 85 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 86 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
87 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'group_id', 'civicrm_group', 'id'); |
88 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'organization_id', 'civicrm_contact', 'id'); | |
346aaaba | 89 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 90 | } |
346aaaba | 91 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 92 | } |
c3fc2621 | 93 | |
e501603b TO |
94 | /** |
95 | * Returns all the column names of this table | |
96 | * | |
97 | * @return array | |
98 | */ | |
c3fc2621 | 99 | public static function &fields() { |
346aaaba | 100 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
101 | Civi::$statics[__CLASS__]['fields'] = [ |
102 | 'id' => [ | |
e501603b TO |
103 | 'name' => 'id', |
104 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 105 | 'title' => ts('Group Organization ID'), |
215b423e | 106 | 'description' => ts('Relationship ID'), |
c3fc2621 | 107 | 'required' => TRUE, |
a36434b9 | 108 | 'where' => 'civicrm_group_organization.id', |
522a26c9 | 109 | 'table_name' => 'civicrm_group_organization', |
110 | 'entity' => 'GroupOrganization', | |
111 | 'bao' => 'CRM_Contact_BAO_GroupOrganization', | |
6a7e5e5d | 112 | 'localizable' => 0, |
2cbbebe8 A |
113 | 'html' => [ |
114 | 'type' => 'Number', | |
115 | ], | |
1fe423d6 | 116 | 'readonly' => TRUE, |
a9d0587b | 117 | 'add' => '2.0', |
c3fc2621 CW |
118 | ], |
119 | 'group_id' => [ | |
e501603b TO |
120 | 'name' => 'group_id', |
121 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 122 | 'title' => ts('Group ID'), |
215b423e | 123 | 'description' => ts('ID of the group'), |
c3fc2621 | 124 | 'required' => TRUE, |
a36434b9 | 125 | 'where' => 'civicrm_group_organization.group_id', |
522a26c9 | 126 | 'table_name' => 'civicrm_group_organization', |
127 | 'entity' => 'GroupOrganization', | |
128 | 'bao' => 'CRM_Contact_BAO_GroupOrganization', | |
6a7e5e5d | 129 | 'localizable' => 0, |
e501603b | 130 | 'FKClassName' => 'CRM_Contact_DAO_Group', |
c3fc2621 | 131 | 'html' => [ |
e501603b | 132 | 'type' => 'Select', |
2cbbebe8 | 133 | 'label' => ts("Group"), |
c3fc2621 CW |
134 | ], |
135 | 'pseudoconstant' => [ | |
e501603b TO |
136 | 'table' => 'civicrm_group', |
137 | 'keyColumn' => 'id', | |
138 | 'labelColumn' => 'title', | |
e6ca0a57 | 139 | ], |
a9d0587b | 140 | 'add' => '2.0', |
c3fc2621 CW |
141 | ], |
142 | 'organization_id' => [ | |
e501603b TO |
143 | 'name' => 'organization_id', |
144 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 145 | 'title' => ts('Organization ID'), |
215b423e | 146 | 'description' => ts('ID of the Organization Contact'), |
c3fc2621 | 147 | 'required' => TRUE, |
a36434b9 | 148 | 'where' => 'civicrm_group_organization.organization_id', |
522a26c9 | 149 | 'table_name' => 'civicrm_group_organization', |
150 | 'entity' => 'GroupOrganization', | |
151 | 'bao' => 'CRM_Contact_BAO_GroupOrganization', | |
6a7e5e5d | 152 | 'localizable' => 0, |
e501603b | 153 | 'FKClassName' => 'CRM_Contact_DAO_Contact', |
2cbbebe8 A |
154 | 'html' => [ |
155 | 'label' => ts("Organization"), | |
156 | ], | |
a9d0587b | 157 | 'add' => '2.0', |
c3fc2621 CW |
158 | ], |
159 | ]; | |
346aaaba | 160 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 161 | } |
346aaaba | 162 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 163 | } |
c3fc2621 | 164 | |
e501603b | 165 | /** |
bd8e0b14 | 166 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
167 | * |
168 | * @return array | |
bd8e0b14 | 169 | * Array(string $name => string $uniqueName). |
e501603b | 170 | */ |
c3fc2621 | 171 | public static function &fieldKeys() { |
bd8e0b14 TO |
172 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
173 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 174 | } |
bd8e0b14 | 175 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 176 | } |
c3fc2621 | 177 | |
e501603b TO |
178 | /** |
179 | * Returns the names of this table | |
180 | * | |
181 | * @return string | |
182 | */ | |
c3fc2621 | 183 | public static function getTableName() { |
e501603b TO |
184 | return self::$_tableName; |
185 | } | |
c3fc2621 | 186 | |
e501603b TO |
187 | /** |
188 | * Returns if this table needs to be logged | |
189 | * | |
c3fc2621 | 190 | * @return bool |
e501603b | 191 | */ |
c3fc2621 | 192 | public function getLog() { |
e501603b TO |
193 | return self::$_log; |
194 | } | |
c3fc2621 | 195 | |
e501603b TO |
196 | /** |
197 | * Returns the list of fields that can be imported | |
198 | * | |
199 | * @param bool $prefix | |
200 | * | |
201 | * @return array | |
202 | */ | |
c3fc2621 CW |
203 | public static function &import($prefix = FALSE) { |
204 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'group_organization', $prefix, []); | |
60808919 | 205 | return $r; |
e501603b | 206 | } |
c3fc2621 | 207 | |
e501603b TO |
208 | /** |
209 | * Returns the list of fields that can be exported | |
210 | * | |
211 | * @param bool $prefix | |
212 | * | |
213 | * @return array | |
214 | */ | |
c3fc2621 CW |
215 | public static function &export($prefix = FALSE) { |
216 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'group_organization', $prefix, []); | |
60808919 | 217 | return $r; |
e501603b | 218 | } |
c3fc2621 | 219 | |
e7a6b91a AS |
220 | /** |
221 | * Returns the list of indices | |
c3fc2621 CW |
222 | * |
223 | * @param bool $localize | |
224 | * | |
225 | * @return array | |
e7a6b91a AS |
226 | */ |
227 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
228 | $indices = [ |
229 | 'UI_group_organization' => [ | |
e7a6b91a | 230 | 'name' => 'UI_group_organization', |
c3fc2621 | 231 | 'field' => [ |
e7a6b91a AS |
232 | 0 => 'group_id', |
233 | 1 => 'organization_id', | |
c3fc2621 CW |
234 | ], |
235 | 'localizable' => FALSE, | |
236 | 'unique' => TRUE, | |
e7a6b91a | 237 | 'sig' => 'civicrm_group_organization::1::group_id::organization_id', |
c3fc2621 CW |
238 | ], |
239 | ]; | |
e7a6b91a AS |
240 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
241 | } | |
c3fc2621 | 242 | |
e501603b | 243 | } |