Merge pull request #23196 from civicrm/5.49
[civicrm-core.git] / CRM / Contact / DAO / ACLContactCache.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/Contact/ACLContactCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:b9913f6181f2b09c71b99f8c41d65c1b)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ACLContactCache entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.1';
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_contact_cache';
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 * primary key
35 *
28979d65
CW
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
e501603b
TO
39 */
40 public $id;
c3fc2621 41
e501603b
TO
42 /**
43 * FK to civicrm_contact (could be null for anon user)
44 *
28979d65
CW
45 * @var int|string|null
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
e501603b
TO
48 */
49 public $user_id;
c3fc2621 50
e501603b
TO
51 /**
52 * FK to civicrm_contact
53 *
28979d65
CW
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
e501603b
TO
57 */
58 public $contact_id;
c3fc2621 59
e501603b
TO
60 /**
61 * What operation does this user have permission on?
62 *
63 * @var string
28979d65
CW
64 * (SQL type: varchar(8))
65 * Note that values will be retrieved from the database as a string.
e501603b
TO
66 */
67 public $operation;
c3fc2621 68
e501603b 69 /**
f41f0342 70 * Class constructor.
e501603b 71 */
c3fc2621 72 public function __construct() {
e501603b
TO
73 $this->__table = 'civicrm_acl_contact_cache';
74 parent::__construct();
75 }
c3fc2621 76
449c4e6b
CW
77 /**
78 * Returns localized title of this entity.
7b66c3b5
AH
79 *
80 * @param bool $plural
81 * Whether to return the plural version of the title.
449c4e6b 82 */
7b66c3b5
AH
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ? ts('ACLContact Caches') : ts('ACLContact Cache');
449c4e6b
CW
85 }
86
e501603b
TO
87 /**
88 * Returns all the column names of this table
89 *
90 * @return array
91 */
c3fc2621 92 public static function &fields() {
346aaaba 93 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
94 Civi::$statics[__CLASS__]['fields'] = [
95 'id' => [
e501603b
TO
96 'name' => 'id',
97 'type' => CRM_Utils_Type::T_INT,
c3fc2621 98 'title' => ts('ACL Contact Cache ID'),
215b423e 99 'description' => ts('primary key'),
c3fc2621 100 'required' => TRUE,
a36434b9 101 'where' => 'civicrm_acl_contact_cache.id',
522a26c9 102 'table_name' => 'civicrm_acl_contact_cache',
103 'entity' => 'ACLContactCache',
104 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 105 'localizable' => 0,
2cbbebe8
A
106 'html' => [
107 'type' => 'Number',
108 ],
1fe423d6 109 'readonly' => TRUE,
a9d0587b 110 'add' => '3.1',
c3fc2621
CW
111 ],
112 'user_id' => [
e501603b
TO
113 'name' => 'user_id',
114 'type' => CRM_Utils_Type::T_INT,
c3fc2621 115 'title' => ts('Contact ID'),
215b423e 116 'description' => ts('FK to civicrm_contact (could be null for anon user)'),
a36434b9 117 'where' => 'civicrm_acl_contact_cache.user_id',
522a26c9 118 'table_name' => 'civicrm_acl_contact_cache',
119 'entity' => 'ACLContactCache',
120 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 121 'localizable' => 0,
a9d0587b 122 'add' => '3.1',
c3fc2621
CW
123 ],
124 'contact_id' => [
e501603b
TO
125 'name' => 'contact_id',
126 'type' => CRM_Utils_Type::T_INT,
c3fc2621 127 'title' => ts('Contact ID'),
215b423e 128 'description' => ts('FK to civicrm_contact'),
c3fc2621 129 'required' => TRUE,
a36434b9 130 'where' => 'civicrm_acl_contact_cache.contact_id',
522a26c9 131 'table_name' => 'civicrm_acl_contact_cache',
132 'entity' => 'ACLContactCache',
133 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 134 'localizable' => 0,
2cbbebe8
A
135 'html' => [
136 'label' => ts("Contact"),
137 ],
a9d0587b 138 'add' => '3.1',
c3fc2621
CW
139 ],
140 'operation' => [
e501603b
TO
141 'name' => 'operation',
142 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 143 'title' => ts('Operation'),
215b423e 144 'description' => ts('What operation does this user have permission on?'),
c3fc2621 145 'required' => TRUE,
e501603b
TO
146 'maxlength' => 8,
147 'size' => CRM_Utils_Type::EIGHT,
a36434b9 148 'where' => 'civicrm_acl_contact_cache.operation',
522a26c9 149 'table_name' => 'civicrm_acl_contact_cache',
150 'entity' => 'ACLContactCache',
151 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 152 'localizable' => 0,
c3fc2621 153 'html' => [
e501603b 154 'type' => 'Select',
c3fc2621
CW
155 ],
156 'pseudoconstant' => [
e501603b 157 'callback' => 'CRM_ACL_BAO_ACL::operation',
e6ca0a57 158 ],
a9d0587b 159 'add' => '1.6',
c3fc2621
CW
160 ],
161 ];
346aaaba 162 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 163 }
346aaaba 164 return Civi::$statics[__CLASS__]['fields'];
e501603b 165 }
c3fc2621 166
e501603b 167 /**
bd8e0b14 168 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
169 *
170 * @return array
bd8e0b14 171 * Array(string $name => string $uniqueName).
e501603b 172 */
c3fc2621 173 public static function &fieldKeys() {
bd8e0b14
TO
174 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
175 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 176 }
bd8e0b14 177 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 178 }
c3fc2621 179
e501603b
TO
180 /**
181 * Returns the names of this table
182 *
183 * @return string
184 */
c3fc2621 185 public static function getTableName() {
e501603b
TO
186 return self::$_tableName;
187 }
c3fc2621 188
e501603b
TO
189 /**
190 * Returns if this table needs to be logged
191 *
c3fc2621 192 * @return bool
e501603b 193 */
c3fc2621 194 public function getLog() {
e501603b
TO
195 return self::$_log;
196 }
c3fc2621 197
e501603b
TO
198 /**
199 * Returns the list of fields that can be imported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
c3fc2621
CW
205 public static function &import($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_contact_cache', $prefix, []);
60808919 207 return $r;
e501603b 208 }
c3fc2621 209
e501603b
TO
210 /**
211 * Returns the list of fields that can be exported
212 *
213 * @param bool $prefix
214 *
215 * @return array
216 */
c3fc2621
CW
217 public static function &export($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_contact_cache', $prefix, []);
60808919 219 return $r;
e501603b 220 }
c3fc2621 221
e7a6b91a
AS
222 /**
223 * Returns the list of indices
c3fc2621
CW
224 *
225 * @param bool $localize
226 *
227 * @return array
e7a6b91a
AS
228 */
229 public static function indices($localize = TRUE) {
c3fc2621
CW
230 $indices = [
231 'UI_user_contact_operation' => [
e7a6b91a 232 'name' => 'UI_user_contact_operation',
c3fc2621 233 'field' => [
e7a6b91a
AS
234 0 => 'user_id',
235 1 => 'contact_id',
236 2 => 'operation',
c3fc2621
CW
237 ],
238 'localizable' => FALSE,
239 'unique' => TRUE,
e7a6b91a 240 'sig' => 'civicrm_acl_contact_cache::1::user_id::contact_id::operation',
c3fc2621
CW
241 ],
242 ];
e7a6b91a
AS
243 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
244 }
c3fc2621 245
e501603b 246}