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