Merge pull request #22639 from civicrm/5.46
[civicrm-core.git] / CRM / ACL / DAO / ACLCache.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b 6 *
28fec8aa 7 * Generated from xml/schema/CRM/ACL/ACLCache.xml
e501603b 8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:329e9070bd70f3fb3d053eb731d1b266)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
28fec8aa 13 * Database access object for the ACLCache entity.
f41f0342 14 */
28fec8aa 15class CRM_ACL_DAO_ACLCache extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.6';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_acl_cache';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * Unique table ID
35 *
28979d65
CW
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
e501603b
TO
39 */
40 public $id;
c3fc2621 41
e501603b
TO
42 /**
43 * Foreign Key to Contact
44 *
28979d65
CW
45 * @var int|string|null
46 * (SQL type: int unsigned)
47 * Note that values will be retrieved from the database as a string.
e501603b
TO
48 */
49 public $contact_id;
c3fc2621 50
e501603b
TO
51 /**
52 * Foreign Key to ACL
53 *
28979d65
CW
54 * @var int|string
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
e501603b
TO
57 */
58 public $acl_id;
c3fc2621 59
e501603b
TO
60 /**
61 * When was this cache entry last modified
62 *
28979d65
CW
63 * @var string
64 * (SQL type: timestamp)
65 * Note that values will be retrieved from the database as a string.
e501603b
TO
66 */
67 public $modified_date;
c3fc2621 68
e501603b 69 /**
f41f0342 70 * Class constructor.
e501603b 71 */
c3fc2621 72 public function __construct() {
e501603b
TO
73 $this->__table = 'civicrm_acl_cache';
74 parent::__construct();
75 }
c3fc2621 76
449c4e6b
CW
77 /**
78 * Returns localized title of this entity.
7b66c3b5
AH
79 *
80 * @param bool $plural
81 * Whether to return the plural version of the title.
449c4e6b 82 */
7b66c3b5
AH
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ? ts('ACLCaches') : ts('ACLCache');
449c4e6b
CW
85 }
86
e501603b 87 /**
f41f0342 88 * Returns foreign keys and entity references.
e501603b
TO
89 *
90 * @return array
91 * [CRM_Core_Reference_Interface]
92 */
c3fc2621 93 public static function getReferenceColumns() {
346aaaba 94 if (!isset(Civi::$statics[__CLASS__]['links'])) {
cf0d1c08 95 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 96 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', 'id');
346aaaba 97 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 98 }
346aaaba 99 return Civi::$statics[__CLASS__]['links'];
e501603b 100 }
c3fc2621 101
e501603b
TO
102 /**
103 * Returns all the column names of this table
104 *
105 * @return array
106 */
c3fc2621 107 public static function &fields() {
346aaaba 108 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
109 Civi::$statics[__CLASS__]['fields'] = [
110 'id' => [
e501603b
TO
111 'name' => 'id',
112 'type' => CRM_Utils_Type::T_INT,
c3fc2621 113 'title' => ts('Cache ID'),
215b423e 114 'description' => ts('Unique table ID'),
c3fc2621 115 'required' => TRUE,
a36434b9 116 'where' => 'civicrm_acl_cache.id',
522a26c9 117 'table_name' => 'civicrm_acl_cache',
28fec8aa
PN
118 'entity' => 'ACLCache',
119 'bao' => 'CRM_ACL_DAO_ACLCache',
6a7e5e5d 120 'localizable' => 0,
2cbbebe8
A
121 'html' => [
122 'type' => 'Number',
123 ],
1fe423d6 124 'readonly' => TRUE,
a9d0587b 125 'add' => '1.6',
c3fc2621
CW
126 ],
127 'contact_id' => [
e501603b
TO
128 'name' => 'contact_id',
129 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 130 'title' => ts('Contact ID'),
215b423e 131 'description' => ts('Foreign Key to Contact'),
a36434b9 132 'where' => 'civicrm_acl_cache.contact_id',
522a26c9 133 'table_name' => 'civicrm_acl_cache',
28fec8aa
PN
134 'entity' => 'ACLCache',
135 'bao' => 'CRM_ACL_DAO_ACLCache',
6a7e5e5d 136 'localizable' => 0,
1906ff52
PN
137 'html' => [
138 'type' => 'EntityRef',
2cbbebe8 139 'label' => ts("Contact"),
1906ff52 140 ],
a9d0587b 141 'add' => '1.6',
c3fc2621
CW
142 ],
143 'acl_id' => [
e501603b
TO
144 'name' => 'acl_id',
145 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 146 'title' => ts('ACL ID'),
215b423e 147 'description' => ts('Foreign Key to ACL'),
c3fc2621 148 'required' => TRUE,
a36434b9 149 'where' => 'civicrm_acl_cache.acl_id',
522a26c9 150 'table_name' => 'civicrm_acl_cache',
28fec8aa
PN
151 'entity' => 'ACLCache',
152 'bao' => 'CRM_ACL_DAO_ACLCache',
6a7e5e5d 153 'localizable' => 0,
e501603b 154 'FKClassName' => 'CRM_ACL_DAO_ACL',
2cbbebe8
A
155 'html' => [
156 'label' => ts("ACL"),
157 ],
1906ff52
PN
158 'pseudoconstant' => [
159 'table' => 'civicrm_acl',
160 'keyColumn' => 'id',
161 'labelColumn' => 'name',
162 ],
a9d0587b 163 'add' => '1.6',
c3fc2621
CW
164 ],
165 'modified_date' => [
e501603b
TO
166 'name' => 'modified_date',
167 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 168 'title' => ts('Cache Modified Date'),
215b423e 169 'description' => ts('When was this cache entry last modified'),
c3fc2621 170 'required' => FALSE,
a36434b9 171 'where' => 'civicrm_acl_cache.modified_date',
522a26c9 172 'table_name' => 'civicrm_acl_cache',
28fec8aa
PN
173 'entity' => 'ACLCache',
174 'bao' => 'CRM_ACL_DAO_ACLCache',
6a7e5e5d 175 'localizable' => 0,
a9d0587b 176 'add' => '1.6',
c3fc2621
CW
177 ],
178 ];
346aaaba 179 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 180 }
346aaaba 181 return Civi::$statics[__CLASS__]['fields'];
e501603b 182 }
c3fc2621 183
e501603b 184 /**
bd8e0b14 185 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
186 *
187 * @return array
bd8e0b14 188 * Array(string $name => string $uniqueName).
e501603b 189 */
c3fc2621 190 public static function &fieldKeys() {
bd8e0b14
TO
191 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
192 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 193 }
bd8e0b14 194 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 195 }
c3fc2621 196
e501603b
TO
197 /**
198 * Returns the names of this table
199 *
200 * @return string
201 */
c3fc2621 202 public static function getTableName() {
e501603b
TO
203 return self::$_tableName;
204 }
c3fc2621 205
e501603b
TO
206 /**
207 * Returns if this table needs to be logged
208 *
c3fc2621 209 * @return bool
e501603b 210 */
c3fc2621 211 public function getLog() {
e501603b
TO
212 return self::$_log;
213 }
c3fc2621 214
e501603b
TO
215 /**
216 * Returns the list of fields that can be imported
217 *
218 * @param bool $prefix
219 *
220 * @return array
221 */
c3fc2621
CW
222 public static function &import($prefix = FALSE) {
223 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_cache', $prefix, []);
60808919 224 return $r;
e501603b 225 }
c3fc2621 226
e501603b
TO
227 /**
228 * Returns the list of fields that can be exported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
c3fc2621
CW
234 public static function &export($prefix = FALSE) {
235 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_cache', $prefix, []);
60808919 236 return $r;
e501603b 237 }
c3fc2621 238
e7a6b91a
AS
239 /**
240 * Returns the list of indices
c3fc2621
CW
241 *
242 * @param bool $localize
243 *
244 * @return array
e7a6b91a
AS
245 */
246 public static function indices($localize = TRUE) {
c3fc2621 247 $indices = [
d551d3d6
SL
248 'index_contact_id' => [
249 'name' => 'index_contact_id',
250 'field' => [
251 0 => 'contact_id',
252 ],
253 'localizable' => FALSE,
254 'sig' => 'civicrm_acl_cache::0::contact_id',
255 ],
c3fc2621 256 'index_acl_id' => [
e7a6b91a 257 'name' => 'index_acl_id',
c3fc2621 258 'field' => [
e7a6b91a 259 0 => 'acl_id',
c3fc2621
CW
260 ],
261 'localizable' => FALSE,
e7a6b91a 262 'sig' => 'civicrm_acl_cache::0::acl_id',
c3fc2621 263 ],
1ec2637a 264 'index_modified_date' => [
265 'name' => 'index_modified_date',
266 'field' => [
267 0 => 'modified_date',
268 ],
269 'localizable' => FALSE,
270 'sig' => 'civicrm_acl_cache::0::modified_date',
271 ],
c3fc2621 272 ];
e7a6b91a
AS
273 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
274 }
c3fc2621 275
e501603b 276}