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