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