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