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