Merge pull request #20470 from colemanw/entityGet
[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:e1095c2503a3ec13bd3f781ce1df1aaf)
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 * @param bool $plural
73 * Whether to return the plural version of the title.
74 */
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ? ts('ACLContact Caches') : ts('ACLContact Cache');
77 }
78
79 /**
80 * Returns all the column names of this table
81 *
82 * @return array
83 */
84 public static function &fields() {
85 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
86 Civi::$statics[__CLASS__]['fields'] = [
87 'id' => [
88 'name' => 'id',
89 'type' => CRM_Utils_Type::T_INT,
90 'title' => ts('ACL Contact Cache ID'),
91 'description' => ts('primary key'),
92 'required' => TRUE,
93 'where' => 'civicrm_acl_contact_cache.id',
94 'table_name' => 'civicrm_acl_contact_cache',
95 'entity' => 'ACLContactCache',
96 'bao' => 'CRM_Contact_DAO_ACLContactCache',
97 'localizable' => 0,
98 'html' => [
99 'type' => 'Number',
100 ],
101 'readonly' => TRUE,
102 'add' => '3.1',
103 ],
104 'user_id' => [
105 'name' => 'user_id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Contact ID'),
108 'description' => ts('FK to civicrm_contact (could be null for anon user)'),
109 'where' => 'civicrm_acl_contact_cache.user_id',
110 'table_name' => 'civicrm_acl_contact_cache',
111 'entity' => 'ACLContactCache',
112 'bao' => 'CRM_Contact_DAO_ACLContactCache',
113 'localizable' => 0,
114 'add' => '3.1',
115 ],
116 'contact_id' => [
117 'name' => 'contact_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Contact ID'),
120 'description' => ts('FK to civicrm_contact'),
121 'required' => TRUE,
122 'where' => 'civicrm_acl_contact_cache.contact_id',
123 'table_name' => 'civicrm_acl_contact_cache',
124 'entity' => 'ACLContactCache',
125 'bao' => 'CRM_Contact_DAO_ACLContactCache',
126 'localizable' => 0,
127 'html' => [
128 'label' => ts("Contact"),
129 ],
130 'add' => '3.1',
131 ],
132 'operation' => [
133 'name' => 'operation',
134 'type' => CRM_Utils_Type::T_STRING,
135 'title' => ts('Operation'),
136 'description' => ts('What operation does this user have permission on?'),
137 'required' => TRUE,
138 'maxlength' => 8,
139 'size' => CRM_Utils_Type::EIGHT,
140 'where' => 'civicrm_acl_contact_cache.operation',
141 'table_name' => 'civicrm_acl_contact_cache',
142 'entity' => 'ACLContactCache',
143 'bao' => 'CRM_Contact_DAO_ACLContactCache',
144 'localizable' => 0,
145 'html' => [
146 'type' => 'Select',
147 ],
148 'pseudoconstant' => [
149 'callback' => 'CRM_ACL_BAO_ACL::operation',
150 ],
151 'add' => '1.6',
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 }