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