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