Merge pull request #23567 from kurund/honor-roll-fixes
[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:b9913f6181f2b09c71b99f8c41d65c1b)
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|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
39 */
40 public $id;
41
42 /**
43 * FK to civicrm_contact (could be null for anon user)
44 *
45 * @var int|string|null
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
48 */
49 public $user_id;
50
51 /**
52 * FK to civicrm_contact
53 *
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
57 */
58 public $contact_id;
59
60 /**
61 * What operation does this user have permission on?
62 *
63 * @var string
64 * (SQL type: varchar(8))
65 * Note that values will be retrieved from the database as a string.
66 */
67 public $operation;
68
69 /**
70 * Class constructor.
71 */
72 public function __construct() {
73 $this->__table = 'civicrm_acl_contact_cache';
74 parent::__construct();
75 }
76
77 /**
78 * Returns localized title of this entity.
79 *
80 * @param bool $plural
81 * Whether to return the plural version of the title.
82 */
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ? ts('ACLContact Caches') : ts('ACLContact Cache');
85 }
86
87 /**
88 * Returns all the column names of this table
89 *
90 * @return array
91 */
92 public static function &fields() {
93 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
94 Civi::$statics[__CLASS__]['fields'] = [
95 'id' => [
96 'name' => 'id',
97 'type' => CRM_Utils_Type::T_INT,
98 'title' => ts('ACL Contact Cache ID'),
99 'description' => ts('primary key'),
100 'required' => TRUE,
101 'where' => 'civicrm_acl_contact_cache.id',
102 'table_name' => 'civicrm_acl_contact_cache',
103 'entity' => 'ACLContactCache',
104 'bao' => 'CRM_Contact_DAO_ACLContactCache',
105 'localizable' => 0,
106 'html' => [
107 'type' => 'Number',
108 ],
109 'readonly' => TRUE,
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 'html' => [
136 'label' => ts("Contact"),
137 ],
138 'add' => '3.1',
139 ],
140 'operation' => [
141 'name' => 'operation',
142 'type' => CRM_Utils_Type::T_STRING,
143 'title' => ts('Operation'),
144 'description' => ts('What operation does this user have permission on?'),
145 'required' => TRUE,
146 'maxlength' => 8,
147 'size' => CRM_Utils_Type::EIGHT,
148 'where' => 'civicrm_acl_contact_cache.operation',
149 'table_name' => 'civicrm_acl_contact_cache',
150 'entity' => 'ACLContactCache',
151 'bao' => 'CRM_Contact_DAO_ACLContactCache',
152 'localizable' => 0,
153 'html' => [
154 'type' => 'Select',
155 ],
156 'pseudoconstant' => [
157 'callback' => 'CRM_ACL_BAO_ACL::operation',
158 ],
159 'add' => '1.6',
160 ],
161 ];
162 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
163 }
164 return Civi::$statics[__CLASS__]['fields'];
165 }
166
167 /**
168 * Return a mapping from field-name to the corresponding key (as used in fields()).
169 *
170 * @return array
171 * Array(string $name => string $uniqueName).
172 */
173 public static function &fieldKeys() {
174 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
175 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
176 }
177 return Civi::$statics[__CLASS__]['fieldKeys'];
178 }
179
180 /**
181 * Returns the names of this table
182 *
183 * @return string
184 */
185 public static function getTableName() {
186 return self::$_tableName;
187 }
188
189 /**
190 * Returns if this table needs to be logged
191 *
192 * @return bool
193 */
194 public function getLog() {
195 return self::$_log;
196 }
197
198 /**
199 * Returns the list of fields that can be imported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
205 public static function &import($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_contact_cache', $prefix, []);
207 return $r;
208 }
209
210 /**
211 * Returns the list of fields that can be exported
212 *
213 * @param bool $prefix
214 *
215 * @return array
216 */
217 public static function &export($prefix = FALSE) {
218 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_contact_cache', $prefix, []);
219 return $r;
220 }
221
222 /**
223 * Returns the list of indices
224 *
225 * @param bool $localize
226 *
227 * @return array
228 */
229 public static function indices($localize = TRUE) {
230 $indices = [
231 'UI_user_contact_operation' => [
232 'name' => 'UI_user_contact_operation',
233 'field' => [
234 0 => 'user_id',
235 1 => 'contact_id',
236 2 => 'operation',
237 ],
238 'localizable' => FALSE,
239 'unique' => TRUE,
240 'sig' => 'civicrm_acl_contact_cache::1::user_id::contact_id::operation',
241 ],
242 ];
243 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
244 }
245
246 }