Skip to content

Commit

Permalink
Add get/set methods for job instance (#1168)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen authored Feb 8, 2022
1 parent 47bad28 commit 42c8d82
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 3 deletions.
49 changes: 48 additions & 1 deletion Api/Data/JobInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,52 @@ interface JobInterface
const FIELD_RETRIES = 'retries';
const FIELD_ERROR_LOG = 'error_log';
const FIELD_DATA_SIZE = 'data_size';
/**#@-*/

/**
* @return string
*/
public function getClass(): string;

/**
* @param string $class
*
* @return $this
*/
public function setClass(string $class): self;

/**
* @return string
*/
public function getMethod(): string;

/**
* @param string $method
*
* @return $this
*/
public function setMethod(string $method): self;

/**
* @return string
*/
public function getBody(): string;

/**
* @param string $data
*
* @return $this
*/
public function setBody(string $data): self;

/**
* @return int
*/
public function getBodySize(): int;

/**
* @param int $size
*
* @return $this
*/
public function setBodySize(int $size): self;
}
66 changes: 64 additions & 2 deletions Model/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
*
* @method int getPid()
* @method int getStoreId()
* @method string getClass()
* @method string getMethod()
* @method int getDataSize()
* @method int getRetries()
* @method int getMaxRetries()
Expand Down Expand Up @@ -248,4 +246,68 @@ public function saveError(\Exception $e)

return $this;
}

/**
* {@inheritdoc}
*/
public function getClass(): string
{
return $this->getData(self::FIELD_CLASS);
}

/**
* {@inheritdoc}
*/
public function setClass(string $class): JobInterface
{
return $this->setData(self::FIELD_CLASS, $class);
}

/**
* {@inheritdoc}
*/
public function getMethod(): string
{
return $this->getData(self::FIELD_METHOD);
}

/**
* {@inheritdoc}
*/
public function setMethod(string $method): JobInterface
{
return $this->setData(self::FIELD_METHOD, $method);
}

/**
* {@inheritdoc}
*/
public function getBody(): string
{
return $this->getData(self::FIELD_DATA);
}

/**
* {@inheritdoc}
*/
public function setBody(string $data): JobInterface
{
return $this->setData(self::FIELD_DATA, $data);
}

/**
* {@inheritdoc}
*/
public function getBodySize(): int
{
return $this->getData(self::FIELD_DATA_SIZE);
}

/**
* {@inheritdoc}
*/
public function setBodySize(int $size): JobInterface
{
return $this->setData(self::FIELD_DATA_SIZE, $size);
}
}

0 comments on commit 42c8d82

Please sign in to comment.