(NFC) Set _log and _table_name variables to be public
[civicrm-core.git] / CRM / Batch / DAO / EntityBatch.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Batch/EntityBatch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e380ee3b 9 * (GenCodeChecksum:ad54978e70be59ea54b414bbb3131f2f)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the EntityBatch entity.
f41f0342 14 */
e501603b 15class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_entity_batch';
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 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * primary key
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * physical tablename for entity being joined to file, e.g. civicrm_contact
40 *
41 * @var string
42 */
43 public $entity_table;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to entity table specified in entity_table column.
47 *
48 * @var int unsigned
49 */
50 public $entity_id;
c3fc2621 51
e501603b
TO
52 /**
53 * FK to civicrm_batch
54 *
55 * @var int unsigned
56 */
57 public $batch_id;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_entity_batch';
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 74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 75 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
76 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'batch_id', 'civicrm_batch', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
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('EntityBatch ID'),
215b423e 95 'description' => ts('primary key'),
c3fc2621 96 'required' => TRUE,
522a26c9 97 'table_name' => 'civicrm_entity_batch',
98 'entity' => 'EntityBatch',
99 'bao' => 'CRM_Batch_BAO_EntityBatch',
6a7e5e5d 100 'localizable' => 0,
c3fc2621
CW
101 ],
102 'entity_table' => [
e501603b
TO
103 'name' => 'entity_table',
104 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 105 'title' => ts('EntityBatch Table'),
215b423e 106 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
e501603b
TO
107 'maxlength' => 64,
108 'size' => CRM_Utils_Type::BIG,
522a26c9 109 'table_name' => 'civicrm_entity_batch',
110 'entity' => 'EntityBatch',
111 'bao' => 'CRM_Batch_BAO_EntityBatch',
6a7e5e5d 112 'localizable' => 0,
c3fc2621
CW
113 ],
114 'entity_id' => [
e501603b
TO
115 'name' => 'entity_id',
116 'type' => CRM_Utils_Type::T_INT,
c3fc2621 117 'title' => ts('Entity ID'),
215b423e 118 'description' => ts('FK to entity table specified in entity_table column.'),
c3fc2621 119 'required' => TRUE,
522a26c9 120 'table_name' => 'civicrm_entity_batch',
121 'entity' => 'EntityBatch',
122 'bao' => 'CRM_Batch_BAO_EntityBatch',
6a7e5e5d 123 'localizable' => 0,
c3fc2621
CW
124 ],
125 'batch_id' => [
e501603b
TO
126 'name' => 'batch_id',
127 'type' => CRM_Utils_Type::T_INT,
c3fc2621 128 'title' => ts('Batch ID'),
215b423e 129 'description' => ts('FK to civicrm_batch'),
c3fc2621 130 'required' => TRUE,
522a26c9 131 'table_name' => 'civicrm_entity_batch',
132 'entity' => 'EntityBatch',
133 'bao' => 'CRM_Batch_BAO_EntityBatch',
6a7e5e5d 134 'localizable' => 0,
e501603b 135 'FKClassName' => 'CRM_Batch_DAO_Batch',
c3fc2621 136 'pseudoconstant' => [
c76af7c4
E
137 'table' => 'civicrm_batch',
138 'keyColumn' => 'id',
139 'labelColumn' => 'title',
c3fc2621
CW
140 ]
141 ],
142 ];
346aaaba 143 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 144 }
346aaaba 145 return Civi::$statics[__CLASS__]['fields'];
e501603b 146 }
c3fc2621 147
e501603b 148 /**
bd8e0b14 149 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
150 *
151 * @return array
bd8e0b14 152 * Array(string $name => string $uniqueName).
e501603b 153 */
c3fc2621 154 public static function &fieldKeys() {
bd8e0b14
TO
155 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
156 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 157 }
bd8e0b14 158 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 159 }
c3fc2621 160
e501603b
TO
161 /**
162 * Returns the names of this table
163 *
164 * @return string
165 */
c3fc2621 166 public static function getTableName() {
e501603b
TO
167 return self::$_tableName;
168 }
c3fc2621 169
e501603b
TO
170 /**
171 * Returns if this table needs to be logged
172 *
c3fc2621 173 * @return bool
e501603b 174 */
c3fc2621 175 public function getLog() {
e501603b
TO
176 return self::$_log;
177 }
c3fc2621 178
e501603b
TO
179 /**
180 * Returns the list of fields that can be imported
181 *
182 * @param bool $prefix
183 *
184 * @return array
185 */
c3fc2621
CW
186 public static function &import($prefix = FALSE) {
187 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_batch', $prefix, []);
60808919 188 return $r;
e501603b 189 }
c3fc2621 190
e501603b
TO
191 /**
192 * Returns the list of fields that can be exported
193 *
194 * @param bool $prefix
195 *
196 * @return array
197 */
c3fc2621
CW
198 public static function &export($prefix = FALSE) {
199 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_batch', $prefix, []);
60808919 200 return $r;
e501603b 201 }
c3fc2621 202
e7a6b91a
AS
203 /**
204 * Returns the list of indices
c3fc2621
CW
205 *
206 * @param bool $localize
207 *
208 * @return array
e7a6b91a
AS
209 */
210 public static function indices($localize = TRUE) {
c3fc2621
CW
211 $indices = [
212 'index_entity' => [
e7a6b91a 213 'name' => 'index_entity',
c3fc2621 214 'field' => [
e7a6b91a
AS
215 0 => 'entity_table',
216 1 => 'entity_id',
c3fc2621
CW
217 ],
218 'localizable' => FALSE,
e7a6b91a 219 'sig' => 'civicrm_entity_batch::0::entity_table::entity_id',
c3fc2621
CW
220 ],
221 'UI_batch_entity' => [
e7a6b91a 222 'name' => 'UI_batch_entity',
c3fc2621 223 'field' => [
e7a6b91a
AS
224 0 => 'batch_id',
225 1 => 'entity_id',
226 2 => 'entity_table',
c3fc2621
CW
227 ],
228 'localizable' => FALSE,
229 'unique' => TRUE,
e7a6b91a 230 'sig' => 'civicrm_entity_batch::1::batch_id::entity_id::entity_table',
c3fc2621
CW
231 ],
232 ];
e7a6b91a
AS
233 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
234 }
c3fc2621 235
e501603b 236}