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