API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / ACL / DAO / EntityRole.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/ACL/EntityRole.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:2e8133b4c385feaa934b2d14ea40f971)
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
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
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
56 */
57 public $entity_id;
58
59 /**
60 * Is this property active?
61 *
62 * @var bool
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 localized title of this entity.
76 */
77 public static function getEntityTitle() {
78 return ts('Entity Roles');
79 }
80
81 /**
82 * Returns foreign keys and entity references.
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
87 public static function getReferenceColumns() {
88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
89 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
91 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
92 }
93 return Civi::$statics[__CLASS__]['links'];
94 }
95
96 /**
97 * Returns all the column names of this table
98 *
99 * @return array
100 */
101 public static function &fields() {
102 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
103 Civi::$statics[__CLASS__]['fields'] = [
104 'id' => [
105 'name' => 'id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Entity Role'),
108 'description' => ts('Unique table ID'),
109 'required' => TRUE,
110 'where' => 'civicrm_acl_entity_role.id',
111 'table_name' => 'civicrm_acl_entity_role',
112 'entity' => 'EntityRole',
113 'bao' => 'CRM_ACL_BAO_EntityRole',
114 'localizable' => 0,
115 'add' => '1.6',
116 ],
117 'acl_role_id' => [
118 'name' => 'acl_role_id',
119 'type' => CRM_Utils_Type::T_INT,
120 'title' => ts('ACL Role ID'),
121 'description' => ts('Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)'),
122 'required' => TRUE,
123 'where' => 'civicrm_acl_entity_role.acl_role_id',
124 'table_name' => 'civicrm_acl_entity_role',
125 'entity' => 'EntityRole',
126 'bao' => 'CRM_ACL_BAO_EntityRole',
127 'localizable' => 0,
128 'add' => '1.6',
129 ],
130 'entity_table' => [
131 'name' => 'entity_table',
132 'type' => CRM_Utils_Type::T_STRING,
133 'title' => ts('Entity Table'),
134 'description' => ts('Table of the object joined to the ACL Role (Contact or Group)'),
135 'required' => TRUE,
136 'maxlength' => 64,
137 'size' => CRM_Utils_Type::BIG,
138 'where' => 'civicrm_acl_entity_role.entity_table',
139 'table_name' => 'civicrm_acl_entity_role',
140 'entity' => 'EntityRole',
141 'bao' => 'CRM_ACL_BAO_EntityRole',
142 'localizable' => 0,
143 'add' => '1.6',
144 ],
145 'entity_id' => [
146 'name' => 'entity_id',
147 'type' => CRM_Utils_Type::T_INT,
148 'title' => ts('ACL Entity ID'),
149 'description' => ts('ID of the group/contact object being joined'),
150 'required' => TRUE,
151 'where' => 'civicrm_acl_entity_role.entity_id',
152 'table_name' => 'civicrm_acl_entity_role',
153 'entity' => 'EntityRole',
154 'bao' => 'CRM_ACL_BAO_EntityRole',
155 'localizable' => 0,
156 'add' => '1.6',
157 ],
158 'is_active' => [
159 'name' => 'is_active',
160 'type' => CRM_Utils_Type::T_BOOLEAN,
161 'title' => ts('ACL Entity Role is Active'),
162 'description' => ts('Is this property active?'),
163 'where' => 'civicrm_acl_entity_role.is_active',
164 'table_name' => 'civicrm_acl_entity_role',
165 'entity' => 'EntityRole',
166 'bao' => 'CRM_ACL_BAO_EntityRole',
167 'localizable' => 0,
168 'add' => '1.6',
169 ],
170 ];
171 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
172 }
173 return Civi::$statics[__CLASS__]['fields'];
174 }
175
176 /**
177 * Return a mapping from field-name to the corresponding key (as used in fields()).
178 *
179 * @return array
180 * Array(string $name => string $uniqueName).
181 */
182 public static function &fieldKeys() {
183 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
184 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
185 }
186 return Civi::$statics[__CLASS__]['fieldKeys'];
187 }
188
189 /**
190 * Returns the names of this table
191 *
192 * @return string
193 */
194 public static function getTableName() {
195 return self::$_tableName;
196 }
197
198 /**
199 * Returns if this table needs to be logged
200 *
201 * @return bool
202 */
203 public function getLog() {
204 return self::$_log;
205 }
206
207 /**
208 * Returns the list of fields that can be imported
209 *
210 * @param bool $prefix
211 *
212 * @return array
213 */
214 public static function &import($prefix = FALSE) {
215 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_entity_role', $prefix, []);
216 return $r;
217 }
218
219 /**
220 * Returns the list of fields that can be exported
221 *
222 * @param bool $prefix
223 *
224 * @return array
225 */
226 public static function &export($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_entity_role', $prefix, []);
228 return $r;
229 }
230
231 /**
232 * Returns the list of indices
233 *
234 * @param bool $localize
235 *
236 * @return array
237 */
238 public static function indices($localize = TRUE) {
239 $indices = [
240 'index_role' => [
241 'name' => 'index_role',
242 'field' => [
243 0 => 'acl_role_id',
244 ],
245 'localizable' => FALSE,
246 'sig' => 'civicrm_acl_entity_role::0::acl_role_id',
247 ],
248 'index_entity' => [
249 'name' => 'index_entity',
250 'field' => [
251 0 => 'entity_table',
252 1 => 'entity_id',
253 ],
254 'localizable' => FALSE,
255 'sig' => 'civicrm_acl_entity_role::0::entity_table::entity_id',
256 ],
257 ];
258 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
259 }
260
261 }