Merge pull request #20505 from JMAConsulting/contribution_product_api4
[civicrm-core.git] / CRM / ACL / DAO / ACLEntityRole.php
CommitLineData
58b85361
MD
1<?php
2
3/**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/ACL/ACLEntityRole.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:fe3bd0baaffcc93590b3285c6cf96fc1)
58b85361
MD
10 */
11
12/**
13 * Database access object for the ACLEntityRole entity.
14 */
15class CRM_ACL_DAO_ACLEntityRole extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.6';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_acl_entity_role';
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 = FALSE;
32
33 /**
34 * Unique table ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)
42 *
43 * @var int
44 */
45 public $acl_role_id;
46
47 /**
48 * Table of the object joined to the ACL Role (Contact or Group)
49 *
50 * @var string
51 */
52 public $entity_table;
53
54 /**
55 * ID of the group/contact object being joined
56 *
57 * @var int
58 */
59 public $entity_id;
60
61 /**
62 * Is this property active?
63 *
64 * @var bool
65 */
66 public $is_active;
67
68 /**
69 * Class constructor.
70 */
71 public function __construct() {
72 $this->__table = 'civicrm_acl_entity_role';
73 parent::__construct();
74 }
75
76 /**
77 * Returns localized title of this entity.
78 *
79 * @param bool $plural
80 * Whether to return the plural version of the title.
81 */
82 public static function getEntityTitle($plural = FALSE) {
83 return $plural ? ts('ACLEntity Roles') : ts('ACLEntity Role');
84 }
85
86 /**
87 * Returns foreign keys and entity references.
88 *
89 * @return array
90 * [CRM_Core_Reference_Interface]
91 */
92 public static function getReferenceColumns() {
93 if (!isset(Civi::$statics[__CLASS__]['links'])) {
94 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
95 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
96 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
97 }
98 return Civi::$statics[__CLASS__]['links'];
99 }
100
101 /**
102 * Returns all the column names of this table
103 *
104 * @return array
105 */
106 public static function &fields() {
107 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
108 Civi::$statics[__CLASS__]['fields'] = [
109 'id' => [
110 'name' => 'id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Entity Role'),
113 'description' => ts('Unique table ID'),
114 'required' => TRUE,
115 'where' => 'civicrm_acl_entity_role.id',
116 'table_name' => 'civicrm_acl_entity_role',
117 'entity' => 'ACLEntityRole',
118 'bao' => 'CRM_ACL_BAO_ACLEntityRole',
119 'localizable' => 0,
120 'html' => [
121 'type' => 'Number',
122 ],
123 'readonly' => TRUE,
124 'add' => '1.6',
125 ],
126 'acl_role_id' => [
127 'name' => 'acl_role_id',
128 'type' => CRM_Utils_Type::T_INT,
129 'title' => ts('ACL Role ID'),
130 'description' => ts('Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)'),
131 'required' => TRUE,
132 'where' => 'civicrm_acl_entity_role.acl_role_id',
133 'table_name' => 'civicrm_acl_entity_role',
134 'entity' => 'ACLEntityRole',
135 'bao' => 'CRM_ACL_BAO_ACLEntityRole',
136 'localizable' => 0,
2ef3d3b2
EM
137 'pseudoconstant' => [
138 'optionGroupName' => 'acl_role',
139 'optionEditPath' => 'civicrm/admin/options/acl_role',
140 ],
58b85361
MD
141 'add' => '1.6',
142 ],
143 'entity_table' => [
144 'name' => 'entity_table',
145 'type' => CRM_Utils_Type::T_STRING,
146 'title' => ts('Entity Table'),
147 'description' => ts('Table of the object joined to the ACL Role (Contact or Group)'),
148 'required' => TRUE,
149 'maxlength' => 64,
150 'size' => CRM_Utils_Type::BIG,
151 'where' => 'civicrm_acl_entity_role.entity_table',
152 'table_name' => 'civicrm_acl_entity_role',
153 'entity' => 'ACLEntityRole',
154 'bao' => 'CRM_ACL_BAO_ACLEntityRole',
155 'localizable' => 0,
156 'pseudoconstant' => [
157 'callback' => 'CRM_ACL_BAO_ACLEntityRole::entityTables',
158 ],
159 'add' => '1.6',
160 ],
161 'entity_id' => [
162 'name' => 'entity_id',
163 'type' => CRM_Utils_Type::T_INT,
164 'title' => ts('ACL Entity ID'),
165 'description' => ts('ID of the group/contact object being joined'),
166 'required' => TRUE,
167 'where' => 'civicrm_acl_entity_role.entity_id',
168 'table_name' => 'civicrm_acl_entity_role',
169 'entity' => 'ACLEntityRole',
170 'bao' => 'CRM_ACL_BAO_ACLEntityRole',
171 'localizable' => 0,
172 'add' => '1.6',
173 ],
174 'is_active' => [
175 'name' => 'is_active',
176 'type' => CRM_Utils_Type::T_BOOLEAN,
177 'title' => ts('ACL Entity Role is Active'),
178 'description' => ts('Is this property active?'),
179 'where' => 'civicrm_acl_entity_role.is_active',
180 'table_name' => 'civicrm_acl_entity_role',
181 'entity' => 'ACLEntityRole',
182 'bao' => 'CRM_ACL_BAO_ACLEntityRole',
183 'localizable' => 0,
184 'add' => '1.6',
185 ],
186 ];
187 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
188 }
189 return Civi::$statics[__CLASS__]['fields'];
190 }
191
192 /**
193 * Return a mapping from field-name to the corresponding key (as used in fields()).
194 *
195 * @return array
196 * Array(string $name => string $uniqueName).
197 */
198 public static function &fieldKeys() {
199 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
200 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
201 }
202 return Civi::$statics[__CLASS__]['fieldKeys'];
203 }
204
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
210 public static function getTableName() {
211 return self::$_tableName;
212 }
213
214 /**
215 * Returns if this table needs to be logged
216 *
217 * @return bool
218 */
219 public function getLog() {
220 return self::$_log;
221 }
222
223 /**
224 * Returns the list of fields that can be imported
225 *
226 * @param bool $prefix
227 *
228 * @return array
229 */
230 public static function &import($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_entity_role', $prefix, []);
232 return $r;
233 }
234
235 /**
236 * Returns the list of fields that can be exported
237 *
238 * @param bool $prefix
239 *
240 * @return array
241 */
242 public static function &export($prefix = FALSE) {
243 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_entity_role', $prefix, []);
244 return $r;
245 }
246
247 /**
248 * Returns the list of indices
249 *
250 * @param bool $localize
251 *
252 * @return array
253 */
254 public static function indices($localize = TRUE) {
255 $indices = [
256 'index_role' => [
257 'name' => 'index_role',
258 'field' => [
259 0 => 'acl_role_id',
260 ],
261 'localizable' => FALSE,
262 'sig' => 'civicrm_acl_entity_role::0::acl_role_id',
263 ],
264 'index_entity' => [
265 'name' => 'index_entity',
266 'field' => [
267 0 => 'entity_table',
268 1 => 'entity_id',
269 ],
270 'localizable' => FALSE,
271 'sig' => 'civicrm_acl_entity_role::0::entity_table::entity_id',
272 ],
273 ];
274 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
275 }
276
277}