Merge pull request #13337 from GinkgoFJG/crmPageTitle
[civicrm-core.git] / CRM / ACL / DAO / EntityRole.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/ACL/EntityRole.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:c53e5bc404fee6d3f005fbaf15abdb4e)
10 */
11
12 /**
13 * Database access object for the EntityRole entity.
14 */
15 class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_acl_entity_role';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 static $_log = FALSE;
30
31 /**
32 * Unique table ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)
40 *
41 * @var int unsigned
42 */
43 public $acl_role_id;
44
45 /**
46 * Table of the object joined to the ACL Role (Contact or Group)
47 *
48 * @var string
49 */
50 public $entity_table;
51
52 /**
53 * ID of the group/contact object being joined
54 *
55 * @var int unsigned
56 */
57 public $entity_id;
58
59 /**
60 * Is this property active?
61 *
62 * @var boolean
63 */
64 public $is_active;
65
66 /**
67 * Class constructor.
68 */
69 public function __construct() {
70 $this->__table = 'civicrm_acl_entity_role';
71 parent::__construct();
72 }
73
74 /**
75 * Returns foreign keys and entity references.
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
80 public static function getReferenceColumns() {
81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
82 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
84 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
85 }
86 return Civi::$statics[__CLASS__]['links'];
87 }
88
89 /**
90 * Returns all the column names of this table
91 *
92 * @return array
93 */
94 public static function &fields() {
95 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
96 Civi::$statics[__CLASS__]['fields'] = [
97 'id' => [
98 'name' => 'id',
99 'type' => CRM_Utils_Type::T_INT,
100 'title' => ts('Entity Role'),
101 'description' => ts('Unique table ID'),
102 'required' => TRUE,
103 'table_name' => 'civicrm_acl_entity_role',
104 'entity' => 'EntityRole',
105 'bao' => 'CRM_ACL_BAO_EntityRole',
106 'localizable' => 0,
107 ],
108 'acl_role_id' => [
109 'name' => 'acl_role_id',
110 'type' => CRM_Utils_Type::T_INT,
111 'title' => ts('ACL Role ID'),
112 'description' => ts('Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)'),
113 'required' => TRUE,
114 'table_name' => 'civicrm_acl_entity_role',
115 'entity' => 'EntityRole',
116 'bao' => 'CRM_ACL_BAO_EntityRole',
117 'localizable' => 0,
118 ],
119 'entity_table' => [
120 'name' => 'entity_table',
121 'type' => CRM_Utils_Type::T_STRING,
122 'title' => ts('Entity Table'),
123 'description' => ts('Table of the object joined to the ACL Role (Contact or Group)'),
124 'required' => TRUE,
125 'maxlength' => 64,
126 'size' => CRM_Utils_Type::BIG,
127 'table_name' => 'civicrm_acl_entity_role',
128 'entity' => 'EntityRole',
129 'bao' => 'CRM_ACL_BAO_EntityRole',
130 'localizable' => 0,
131 ],
132 'entity_id' => [
133 'name' => 'entity_id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('ACL Entity ID'),
136 'description' => ts('ID of the group/contact object being joined'),
137 'required' => TRUE,
138 'table_name' => 'civicrm_acl_entity_role',
139 'entity' => 'EntityRole',
140 'bao' => 'CRM_ACL_BAO_EntityRole',
141 'localizable' => 0,
142 ],
143 'is_active' => [
144 'name' => 'is_active',
145 'type' => CRM_Utils_Type::T_BOOLEAN,
146 'title' => ts('ACL Entity Role is Active'),
147 'description' => ts('Is this property active?'),
148 'table_name' => 'civicrm_acl_entity_role',
149 'entity' => 'EntityRole',
150 'bao' => 'CRM_ACL_BAO_EntityRole',
151 'localizable' => 0,
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_entity_role', $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_entity_role', $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 'index_role' => [
224 'name' => 'index_role',
225 'field' => [
226 0 => 'acl_role_id',
227 ],
228 'localizable' => FALSE,
229 'sig' => 'civicrm_acl_entity_role::0::acl_role_id',
230 ],
231 'index_entity' => [
232 'name' => 'index_entity',
233 'field' => [
234 0 => 'entity_table',
235 1 => 'entity_id',
236 ],
237 'localizable' => FALSE,
238 'sig' => 'civicrm_acl_entity_role::0::entity_table::entity_id',
239 ],
240 ];
241 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
242 }
243
244 }