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