Commit | Line | Data |
---|---|---|
e501603b | 1 | <?php |
c3fc2621 | 2 | |
e501603b TO |
3 | /** |
4 | * @package CRM | |
0f03f337 | 5 | * @copyright CiviCRM LLC (c) 2004-2017 |
e501603b TO |
6 | * |
7 | * Generated from xml/schema/CRM/ACL/EntityRole.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e7a6b91a | 9 | * (GenCodeChecksum:b6780a8cf74433fd38a0c7f9e6161986) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the EntityRole entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_ACL_DAO_EntityRole 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_entity_role'; | |
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 ACL Role (which is an option value pair and hence an implicit FK) | |
40 | * | |
41 | * @var int unsigned | |
42 | */ | |
43 | public $acl_role_id; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * Table of the object joined to the ACL Role (Contact or Group) | |
47 | * | |
48 | * @var string | |
49 | */ | |
50 | public $entity_table; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * ID of the group/contact object being joined | |
54 | * | |
55 | * @var int unsigned | |
56 | */ | |
57 | public $entity_id; | |
c3fc2621 | 58 | |
e501603b TO |
59 | /** |
60 | * Is this property active? | |
61 | * | |
62 | * @var boolean | |
63 | */ | |
64 | public $is_active; | |
c3fc2621 | 65 | |
e501603b | 66 | /** |
f41f0342 | 67 | * Class constructor. |
e501603b | 68 | */ |
c3fc2621 | 69 | public function __construct() { |
e501603b TO |
70 | $this->__table = 'civicrm_acl_entity_role'; |
71 | parent::__construct(); | |
72 | } | |
c3fc2621 | 73 | |
e501603b | 74 | /** |
f41f0342 | 75 | * Returns foreign keys and entity references. |
e501603b TO |
76 | * |
77 | * @return array | |
78 | * [CRM_Core_Reference_Interface] | |
79 | */ | |
c3fc2621 | 80 | public static function getReferenceColumns() { |
346aaaba TO |
81 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
82 | Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__); | |
c3fc2621 | 83 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); |
346aaaba | 84 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 85 | } |
346aaaba | 86 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 87 | } |
c3fc2621 | 88 | |
e501603b TO |
89 | /** |
90 | * Returns all the column names of this table | |
91 | * | |
92 | * @return array | |
93 | */ | |
c3fc2621 | 94 | public static function &fields() { |
346aaaba | 95 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
96 | Civi::$statics[__CLASS__]['fields'] = [ |
97 | 'id' => [ | |
e501603b TO |
98 | 'name' => 'id', |
99 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 100 | 'title' => ts('Entity Role'), |
e501603b | 101 | 'description' => 'Unique table ID', |
c3fc2621 | 102 | 'required' => TRUE, |
522a26c9 | 103 | 'table_name' => 'civicrm_acl_entity_role', |
104 | 'entity' => 'EntityRole', | |
105 | 'bao' => 'CRM_ACL_BAO_EntityRole', | |
6a7e5e5d | 106 | 'localizable' => 0, |
c3fc2621 CW |
107 | ], |
108 | 'acl_role_id' => [ | |
e501603b TO |
109 | 'name' => 'acl_role_id', |
110 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 111 | 'title' => ts('ACL Role ID'), |
e501603b | 112 | 'description' => 'Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)', |
c3fc2621 | 113 | 'required' => TRUE, |
522a26c9 | 114 | 'table_name' => 'civicrm_acl_entity_role', |
115 | 'entity' => 'EntityRole', | |
116 | 'bao' => 'CRM_ACL_BAO_EntityRole', | |
6a7e5e5d | 117 | 'localizable' => 0, |
c3fc2621 CW |
118 | ], |
119 | 'entity_table' => [ | |
e501603b TO |
120 | 'name' => 'entity_table', |
121 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 122 | 'title' => ts('Entity Table'), |
e501603b | 123 | 'description' => 'Table of the object joined to the ACL Role (Contact or Group)', |
c3fc2621 | 124 | 'required' => TRUE, |
e501603b TO |
125 | 'maxlength' => 64, |
126 | 'size' => CRM_Utils_Type::BIG, | |
522a26c9 | 127 | 'table_name' => 'civicrm_acl_entity_role', |
128 | 'entity' => 'EntityRole', | |
129 | 'bao' => 'CRM_ACL_BAO_EntityRole', | |
6a7e5e5d | 130 | 'localizable' => 0, |
c3fc2621 CW |
131 | ], |
132 | 'entity_id' => [ | |
e501603b TO |
133 | 'name' => 'entity_id', |
134 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 135 | 'title' => ts('ACL Entity ID'), |
e501603b | 136 | 'description' => 'ID of the group/contact object being joined', |
c3fc2621 | 137 | 'required' => TRUE, |
522a26c9 | 138 | 'table_name' => 'civicrm_acl_entity_role', |
139 | 'entity' => 'EntityRole', | |
140 | 'bao' => 'CRM_ACL_BAO_EntityRole', | |
6a7e5e5d | 141 | 'localizable' => 0, |
c3fc2621 CW |
142 | ], |
143 | 'is_active' => [ | |
e501603b TO |
144 | 'name' => 'is_active', |
145 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
c3fc2621 | 146 | 'title' => ts('ACL Entity Role is Active'), |
e501603b | 147 | 'description' => 'Is this property active?', |
522a26c9 | 148 | 'table_name' => 'civicrm_acl_entity_role', |
149 | 'entity' => 'EntityRole', | |
150 | 'bao' => 'CRM_ACL_BAO_EntityRole', | |
6a7e5e5d | 151 | 'localizable' => 0, |
c3fc2621 CW |
152 | ], |
153 | ]; | |
346aaaba | 154 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 155 | } |
346aaaba | 156 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 157 | } |
c3fc2621 | 158 | |
e501603b | 159 | /** |
bd8e0b14 | 160 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
161 | * |
162 | * @return array | |
bd8e0b14 | 163 | * Array(string $name => string $uniqueName). |
e501603b | 164 | */ |
c3fc2621 | 165 | public static function &fieldKeys() { |
bd8e0b14 TO |
166 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
167 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 168 | } |
bd8e0b14 | 169 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 170 | } |
c3fc2621 | 171 | |
e501603b TO |
172 | /** |
173 | * Returns the names of this table | |
174 | * | |
175 | * @return string | |
176 | */ | |
c3fc2621 | 177 | public static function getTableName() { |
e501603b TO |
178 | return self::$_tableName; |
179 | } | |
c3fc2621 | 180 | |
e501603b TO |
181 | /** |
182 | * Returns if this table needs to be logged | |
183 | * | |
c3fc2621 | 184 | * @return bool |
e501603b | 185 | */ |
c3fc2621 | 186 | public function getLog() { |
e501603b TO |
187 | return self::$_log; |
188 | } | |
c3fc2621 | 189 | |
e501603b TO |
190 | /** |
191 | * Returns the list of fields that can be imported | |
192 | * | |
193 | * @param bool $prefix | |
194 | * | |
195 | * @return array | |
196 | */ | |
c3fc2621 CW |
197 | public static function &import($prefix = FALSE) { |
198 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_entity_role', $prefix, []); | |
60808919 | 199 | return $r; |
e501603b | 200 | } |
c3fc2621 | 201 | |
e501603b TO |
202 | /** |
203 | * Returns the list of fields that can be exported | |
204 | * | |
205 | * @param bool $prefix | |
206 | * | |
207 | * @return array | |
208 | */ | |
c3fc2621 CW |
209 | public static function &export($prefix = FALSE) { |
210 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_entity_role', $prefix, []); | |
60808919 | 211 | return $r; |
e501603b | 212 | } |
c3fc2621 | 213 | |
e7a6b91a AS |
214 | /** |
215 | * Returns the list of indices | |
c3fc2621 CW |
216 | * |
217 | * @param bool $localize | |
218 | * | |
219 | * @return array | |
e7a6b91a AS |
220 | */ |
221 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
222 | $indices = [ |
223 | 'index_role' => [ | |
e7a6b91a | 224 | 'name' => 'index_role', |
c3fc2621 | 225 | 'field' => [ |
e7a6b91a | 226 | 0 => 'acl_role_id', |
c3fc2621 CW |
227 | ], |
228 | 'localizable' => FALSE, | |
e7a6b91a | 229 | 'sig' => 'civicrm_acl_entity_role::0::acl_role_id', |
c3fc2621 CW |
230 | ], |
231 | 'index_entity' => [ | |
e7a6b91a | 232 | 'name' => 'index_entity', |
c3fc2621 | 233 | 'field' => [ |
e7a6b91a AS |
234 | 0 => 'entity_table', |
235 | 1 => 'entity_id', | |
c3fc2621 CW |
236 | ], |
237 | 'localizable' => FALSE, | |
e7a6b91a | 238 | 'sig' => 'civicrm_acl_entity_role::0::entity_table::entity_id', |
c3fc2621 CW |
239 | ], |
240 | ]; | |
e7a6b91a AS |
241 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
242 | } | |
c3fc2621 | 243 | |
e501603b | 244 | } |