Merge pull request #10403 from yashodha/CRM-20624
[civicrm-core.git] / CRM / Queue / DAO / QueueItem.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Queue/QueueItem.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:9049b4828c213985dea2180555f28568)
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 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 static $_log = FALSE;
30
31 /**
32 * @var int unsigned
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 all the column names of this table
79 *
80 * @return array
81 */
82 public static function &fields() {
83 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
84 Civi::$statics[__CLASS__]['fields'] = [
85 'id' => [
86 'name' => 'id',
87 'type' => CRM_Utils_Type::T_INT,
88 'title' => ts('Queue ID'),
89 'required' => TRUE,
90 'table_name' => 'civicrm_queue_item',
91 'entity' => 'QueueItem',
92 'bao' => 'CRM_Queue_BAO_QueueItem',
93 'localizable' => 0,
94 ],
95 'queue_name' => [
96 'name' => 'queue_name',
97 'type' => CRM_Utils_Type::T_STRING,
98 'title' => ts('Queue Name'),
99 'description' => 'Name of the queue which includes this item',
100 'required' => TRUE,
101 'maxlength' => 64,
102 'size' => CRM_Utils_Type::BIG,
103 'table_name' => 'civicrm_queue_item',
104 'entity' => 'QueueItem',
105 'bao' => 'CRM_Queue_BAO_QueueItem',
106 'localizable' => 0,
107 'html' => [
108 'type' => 'Text',
109 ],
110 ],
111 'weight' => [
112 'name' => 'weight',
113 'type' => CRM_Utils_Type::T_INT,
114 'title' => ts('Order'),
115 'required' => TRUE,
116 'table_name' => 'civicrm_queue_item',
117 'entity' => 'QueueItem',
118 'bao' => 'CRM_Queue_BAO_QueueItem',
119 'localizable' => 0,
120 'html' => [
121 'type' => 'Text',
122 ],
123 ],
124 'submit_time' => [
125 'name' => 'submit_time',
126 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
127 'title' => ts('Submit Time'),
128 'description' => 'date on which this item was submitted to the queue',
129 'required' => TRUE,
130 'table_name' => 'civicrm_queue_item',
131 'entity' => 'QueueItem',
132 'bao' => 'CRM_Queue_BAO_QueueItem',
133 'localizable' => 0,
134 'html' => [
135 'type' => 'Select Date',
136 ],
137 ],
138 'release_time' => [
139 'name' => 'release_time',
140 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
141 'title' => ts('Release Time'),
142 'description' => 'date on which this job becomes available; null if ASAP',
143 'table_name' => 'civicrm_queue_item',
144 'entity' => 'QueueItem',
145 'bao' => 'CRM_Queue_BAO_QueueItem',
146 'localizable' => 0,
147 'html' => [
148 'type' => 'Select Date',
149 ],
150 ],
151 'data' => [
152 'name' => 'data',
153 'type' => CRM_Utils_Type::T_TEXT,
154 'title' => ts('Queue item data'),
155 'description' => 'Serialized queue data',
156 'table_name' => 'civicrm_queue_item',
157 'entity' => 'QueueItem',
158 'bao' => 'CRM_Queue_BAO_QueueItem',
159 'localizable' => 0,
160 'serialize' => self::SERIALIZE_PHP,
161 ],
162 ];
163 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
164 }
165 return Civi::$statics[__CLASS__]['fields'];
166 }
167
168 /**
169 * Return a mapping from field-name to the corresponding key (as used in fields()).
170 *
171 * @return array
172 * Array(string $name => string $uniqueName).
173 */
174 public static function &fieldKeys() {
175 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
176 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
177 }
178 return Civi::$statics[__CLASS__]['fieldKeys'];
179 }
180
181 /**
182 * Returns the names of this table
183 *
184 * @return string
185 */
186 public static function getTableName() {
187 return self::$_tableName;
188 }
189
190 /**
191 * Returns if this table needs to be logged
192 *
193 * @return bool
194 */
195 public function getLog() {
196 return self::$_log;
197 }
198
199 /**
200 * Returns the list of fields that can be imported
201 *
202 * @param bool $prefix
203 *
204 * @return array
205 */
206 public static function &import($prefix = FALSE) {
207 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'queue_item', $prefix, []);
208 return $r;
209 }
210
211 /**
212 * Returns the list of fields that can be exported
213 *
214 * @param bool $prefix
215 *
216 * @return array
217 */
218 public static function &export($prefix = FALSE) {
219 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'queue_item', $prefix, []);
220 return $r;
221 }
222
223 /**
224 * Returns the list of indices
225 *
226 * @param bool $localize
227 *
228 * @return array
229 */
230 public static function indices($localize = TRUE) {
231 $indices = [
232 'index_queueids' => [
233 'name' => 'index_queueids',
234 'field' => [
235 0 => 'queue_name',
236 1 => 'weight',
237 2 => 'id',
238 ],
239 'localizable' => FALSE,
240 'sig' => 'civicrm_queue_item::0::queue_name::weight::id',
241 ],
242 ];
243 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
244 }
245
246 }