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