Merge pull request #17640 from samuelsov/bugreportcivigrant
[civicrm-core.git] / CRM / Queue / DAO / QueueItem.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Queue/QueueItem.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4b3a1116045b1c18e6aa3288bbd07b49)
10 */
11
12 /**
13 * Database access object for the QueueItem entity.
14 */
15 class CRM_Queue_DAO_QueueItem extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_queue_item';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * @var int
33 */
34 public $id;
35
36 /**
37 * Name of the queue which includes this item
38 *
39 * @var string
40 */
41 public $queue_name;
42
43 /**
44 * @var int
45 */
46 public $weight;
47
48 /**
49 * date on which this item was submitted to the queue
50 *
51 * @var datetime
52 */
53 public $submit_time;
54
55 /**
56 * date on which this job becomes available; null if ASAP
57 *
58 * @var datetime
59 */
60 public $release_time;
61
62 /**
63 * Serialized queue data
64 *
65 * @var text
66 */
67 public $data;
68
69 /**
70 * Class constructor.
71 */
72 public function __construct() {
73 $this->__table = 'civicrm_queue_item';
74 parent::__construct();
75 }
76
77 /**
78 * Returns localized title of this entity.
79 */
80 public static function getEntityTitle() {
81 return ts('Queue Items');
82 }
83
84 /**
85 * Returns all the column names of this table
86 *
87 * @return array
88 */
89 public static function &fields() {
90 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
91 Civi::$statics[__CLASS__]['fields'] = [
92 'id' => [
93 'name' => 'id',
94 'type' => CRM_Utils_Type::T_INT,
95 'title' => ts('Queue ID'),
96 'required' => TRUE,
97 'where' => 'civicrm_queue_item.id',
98 'table_name' => 'civicrm_queue_item',
99 'entity' => 'QueueItem',
100 'bao' => 'CRM_Queue_BAO_QueueItem',
101 'localizable' => 0,
102 ],
103 'queue_name' => [
104 'name' => 'queue_name',
105 'type' => CRM_Utils_Type::T_STRING,
106 'title' => ts('Queue Name'),
107 'description' => ts('Name of the queue which includes this item'),
108 'required' => TRUE,
109 'maxlength' => 64,
110 'size' => CRM_Utils_Type::BIG,
111 'where' => 'civicrm_queue_item.queue_name',
112 'table_name' => 'civicrm_queue_item',
113 'entity' => 'QueueItem',
114 'bao' => 'CRM_Queue_BAO_QueueItem',
115 'localizable' => 0,
116 'html' => [
117 'type' => 'Text',
118 ],
119 ],
120 'weight' => [
121 'name' => 'weight',
122 'type' => CRM_Utils_Type::T_INT,
123 'title' => ts('Order'),
124 'required' => TRUE,
125 'where' => 'civicrm_queue_item.weight',
126 'table_name' => 'civicrm_queue_item',
127 'entity' => 'QueueItem',
128 'bao' => 'CRM_Queue_BAO_QueueItem',
129 'localizable' => 0,
130 'html' => [
131 'type' => 'Text',
132 ],
133 ],
134 'submit_time' => [
135 'name' => 'submit_time',
136 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
137 'title' => ts('Submit Time'),
138 'description' => ts('date on which this item was submitted to the queue'),
139 'required' => TRUE,
140 'where' => 'civicrm_queue_item.submit_time',
141 'table_name' => 'civicrm_queue_item',
142 'entity' => 'QueueItem',
143 'bao' => 'CRM_Queue_BAO_QueueItem',
144 'localizable' => 0,
145 'html' => [
146 'type' => 'Select Date',
147 ],
148 ],
149 'release_time' => [
150 'name' => 'release_time',
151 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
152 'title' => ts('Release Time'),
153 'description' => ts('date on which this job becomes available; null if ASAP'),
154 'where' => 'civicrm_queue_item.release_time',
155 'table_name' => 'civicrm_queue_item',
156 'entity' => 'QueueItem',
157 'bao' => 'CRM_Queue_BAO_QueueItem',
158 'localizable' => 0,
159 'html' => [
160 'type' => 'Select Date',
161 ],
162 ],
163 'data' => [
164 'name' => 'data',
165 'type' => CRM_Utils_Type::T_TEXT,
166 'title' => ts('Queue item data'),
167 'description' => ts('Serialized queue data'),
168 'where' => 'civicrm_queue_item.data',
169 'table_name' => 'civicrm_queue_item',
170 'entity' => 'QueueItem',
171 'bao' => 'CRM_Queue_BAO_QueueItem',
172 'localizable' => 0,
173 'serialize' => self::SERIALIZE_PHP,
174 ],
175 ];
176 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
177 }
178 return Civi::$statics[__CLASS__]['fields'];
179 }
180
181 /**
182 * Return a mapping from field-name to the corresponding key (as used in fields()).
183 *
184 * @return array
185 * Array(string $name => string $uniqueName).
186 */
187 public static function &fieldKeys() {
188 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
189 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
190 }
191 return Civi::$statics[__CLASS__]['fieldKeys'];
192 }
193
194 /**
195 * Returns the names of this table
196 *
197 * @return string
198 */
199 public static function getTableName() {
200 return self::$_tableName;
201 }
202
203 /**
204 * Returns if this table needs to be logged
205 *
206 * @return bool
207 */
208 public function getLog() {
209 return self::$_log;
210 }
211
212 /**
213 * Returns the list of fields that can be imported
214 *
215 * @param bool $prefix
216 *
217 * @return array
218 */
219 public static function &import($prefix = FALSE) {
220 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []);
221 return $r;
222 }
223
224 /**
225 * Returns the list of fields that can be exported
226 *
227 * @param bool $prefix
228 *
229 * @return array
230 */
231 public static function &export($prefix = FALSE) {
232 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []);
233 return $r;
234 }
235
236 /**
237 * Returns the list of indices
238 *
239 * @param bool $localize
240 *
241 * @return array
242 */
243 public static function indices($localize = TRUE) {
244 $indices = [
245 'index_queueids' => [
246 'name' => 'index_queueids',
247 'field' => [
248 0 => 'queue_name',
249 1 => 'weight',
250 2 => 'id',
251 ],
252 'localizable' => FALSE,
253 'sig' => 'civicrm_queue_item::0::queue_name::weight::id',
254 ],
255 ];
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
257 }
258
259 }