Skip to content

Commit 42c8d82

Browse files
author
Jeroen
authored
Add get/set methods for job instance (#1168)
1 parent 47bad28 commit 42c8d82

File tree

2 files changed

+112
-3
lines changed

2 files changed

+112
-3
lines changed

Api/Data/JobInterface.php

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,52 @@ interface JobInterface
2929
const FIELD_RETRIES = 'retries';
3030
const FIELD_ERROR_LOG = 'error_log';
3131
const FIELD_DATA_SIZE = 'data_size';
32-
/**#@-*/
32+
33+
/**
34+
* @return string
35+
*/
36+
public function getClass(): string;
37+
38+
/**
39+
* @param string $class
40+
*
41+
* @return $this
42+
*/
43+
public function setClass(string $class): self;
44+
45+
/**
46+
* @return string
47+
*/
48+
public function getMethod(): string;
49+
50+
/**
51+
* @param string $method
52+
*
53+
* @return $this
54+
*/
55+
public function setMethod(string $method): self;
56+
57+
/**
58+
* @return string
59+
*/
60+
public function getBody(): string;
61+
62+
/**
63+
* @param string $data
64+
*
65+
* @return $this
66+
*/
67+
public function setBody(string $data): self;
68+
69+
/**
70+
* @return int
71+
*/
72+
public function getBodySize(): int;
73+
74+
/**
75+
* @param int $size
76+
*
77+
* @return $this
78+
*/
79+
public function setBodySize(int $size): self;
3380
}

Model/Job.php

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
*
1010
* @method int getPid()
1111
* @method int getStoreId()
12-
* @method string getClass()
13-
* @method string getMethod()
1412
* @method int getDataSize()
1513
* @method int getRetries()
1614
* @method int getMaxRetries()
@@ -248,4 +246,68 @@ public function saveError(\Exception $e)
248246

249247
return $this;
250248
}
249+
250+
/**
251+
* {@inheritdoc}
252+
*/
253+
public function getClass(): string
254+
{
255+
return $this->getData(self::FIELD_CLASS);
256+
}
257+
258+
/**
259+
* {@inheritdoc}
260+
*/
261+
public function setClass(string $class): JobInterface
262+
{
263+
return $this->setData(self::FIELD_CLASS, $class);
264+
}
265+
266+
/**
267+
* {@inheritdoc}
268+
*/
269+
public function getMethod(): string
270+
{
271+
return $this->getData(self::FIELD_METHOD);
272+
}
273+
274+
/**
275+
* {@inheritdoc}
276+
*/
277+
public function setMethod(string $method): JobInterface
278+
{
279+
return $this->setData(self::FIELD_METHOD, $method);
280+
}
281+
282+
/**
283+
* {@inheritdoc}
284+
*/
285+
public function getBody(): string
286+
{
287+
return $this->getData(self::FIELD_DATA);
288+
}
289+
290+
/**
291+
* {@inheritdoc}
292+
*/
293+
public function setBody(string $data): JobInterface
294+
{
295+
return $this->setData(self::FIELD_DATA, $data);
296+
}
297+
298+
/**
299+
* {@inheritdoc}
300+
*/
301+
public function getBodySize(): int
302+
{
303+
return $this->getData(self::FIELD_DATA_SIZE);
304+
}
305+
306+
/**
307+
* {@inheritdoc}
308+
*/
309+
public function setBodySize(int $size): JobInterface
310+
{
311+
return $this->setData(self::FIELD_DATA_SIZE, $size);
312+
}
251313
}

0 commit comments

Comments
 (0)