Merge pull request #11679 from jitendrapurohit/CRM-21776
[civicrm-core.git] / CRM / ACL / DAO / Cache.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/ACL/Cache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 9 * (GenCodeChecksum:f65002b394a3b1f9c18de75751364acc)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Cache entity.
f41f0342 14 */
e501603b 15class CRM_ACL_DAO_Cache 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_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 * Unique table ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign Key to Contact
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Foreign Key to ACL
47 *
48 * @var int unsigned
49 */
50 public $acl_id;
c3fc2621 51
e501603b
TO
52 /**
53 * When was this cache entry last modified
54 *
55 * @var timestamp
56 */
57 public $modified_date;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_acl_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(), 'contact_id', 'civicrm_contact', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', '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('Cache ID'),
e501603b 95 'description' => 'Unique table ID',
c3fc2621 96 'required' => TRUE,
522a26c9 97 'table_name' => 'civicrm_acl_cache',
98 'entity' => 'Cache',
99 'bao' => 'CRM_ACL_BAO_Cache',
6a7e5e5d 100 'localizable' => 0,
c3fc2621
CW
101 ],
102 'contact_id' => [
e501603b
TO
103 'name' => 'contact_id',
104 'type' => CRM_Utils_Type::T_INT,
c3fc2621 105 'title' => ts('Cache Contact'),
e501603b 106 'description' => 'Foreign Key to Contact',
522a26c9 107 'table_name' => 'civicrm_acl_cache',
108 'entity' => 'Cache',
109 'bao' => 'CRM_ACL_BAO_Cache',
6a7e5e5d 110 'localizable' => 0,
e501603b 111 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
112 ],
113 'acl_id' => [
e501603b
TO
114 'name' => 'acl_id',
115 'type' => CRM_Utils_Type::T_INT,
c3fc2621 116 'title' => ts('Cache ACL'),
e501603b 117 'description' => 'Foreign Key to ACL',
c3fc2621 118 'required' => TRUE,
522a26c9 119 'table_name' => 'civicrm_acl_cache',
120 'entity' => 'Cache',
121 'bao' => 'CRM_ACL_BAO_Cache',
6a7e5e5d 122 'localizable' => 0,
e501603b 123 'FKClassName' => 'CRM_ACL_DAO_ACL',
c3fc2621
CW
124 ],
125 'modified_date' => [
e501603b
TO
126 'name' => 'modified_date',
127 'type' => CRM_Utils_Type::T_TIMESTAMP,
c3fc2621 128 'title' => ts('Cache Modified Date'),
e501603b 129 'description' => 'When was this cache entry last modified',
c3fc2621 130 'required' => FALSE,
522a26c9 131 'table_name' => 'civicrm_acl_cache',
132 'entity' => 'Cache',
133 'bao' => 'CRM_ACL_BAO_Cache',
6a7e5e5d 134 'localizable' => 0,
c3fc2621
CW
135 ],
136 ];
346aaaba 137 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 138 }
346aaaba 139 return Civi::$statics[__CLASS__]['fields'];
e501603b 140 }
c3fc2621 141
e501603b 142 /**
bd8e0b14 143 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
144 *
145 * @return array
bd8e0b14 146 * Array(string $name => string $uniqueName).
e501603b 147 */
c3fc2621 148 public static function &fieldKeys() {
bd8e0b14
TO
149 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
150 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 151 }
bd8e0b14 152 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 153 }
c3fc2621 154
e501603b
TO
155 /**
156 * Returns the names of this table
157 *
158 * @return string
159 */
c3fc2621 160 public static function getTableName() {
e501603b
TO
161 return self::$_tableName;
162 }
c3fc2621 163
e501603b
TO
164 /**
165 * Returns if this table needs to be logged
166 *
c3fc2621 167 * @return bool
e501603b 168 */
c3fc2621 169 public function getLog() {
e501603b
TO
170 return self::$_log;
171 }
c3fc2621 172
e501603b
TO
173 /**
174 * Returns the list of fields that can be imported
175 *
176 * @param bool $prefix
177 *
178 * @return array
179 */
c3fc2621
CW
180 public static function &import($prefix = FALSE) {
181 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_cache', $prefix, []);
60808919 182 return $r;
e501603b 183 }
c3fc2621 184
e501603b
TO
185 /**
186 * Returns the list of fields that can be exported
187 *
188 * @param bool $prefix
189 *
190 * @return array
191 */
c3fc2621
CW
192 public static function &export($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_cache', $prefix, []);
60808919 194 return $r;
e501603b 195 }
c3fc2621 196
e7a6b91a
AS
197 /**
198 * Returns the list of indices
c3fc2621
CW
199 *
200 * @param bool $localize
201 *
202 * @return array
e7a6b91a
AS
203 */
204 public static function indices($localize = TRUE) {
c3fc2621
CW
205 $indices = [
206 'index_acl_id' => [
e7a6b91a 207 'name' => 'index_acl_id',
c3fc2621 208 'field' => [
e7a6b91a 209 0 => 'acl_id',
c3fc2621
CW
210 ],
211 'localizable' => FALSE,
e7a6b91a 212 'sig' => 'civicrm_acl_cache::0::acl_id',
c3fc2621
CW
213 ],
214 ];
e7a6b91a
AS
215 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
216 }
c3fc2621 217
e501603b 218}