Skip to content

@b-b3rn4rd /Job.php
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Zend_Queue background job abstract class
<?php
/**
* Zend_Queue background job abstract class
*
* @author Bernard Baltrusaitis <bernard@runawaylover.info>
*/
abstract class My_Job
{
/**
*
* @var Zend_Queue
*/
protected $_queue = null;
/**
* Executes given job
*
* @return boolean true if job was successful
*/
abstract function job();
public function __construct(Zend_Queue $queue)
{
$this->_queue = $queue;
}
public function setOptions(array $options)
{
foreach ($options as $name => $value) {
$property = sprintf('_%s', $name);
if (property_exists($this, $property)) {
$this->{$property} = $value;
}
}
}
/**
* Send job to queue
*
* @return Zend_Queue_Message
*/
public function execute()
{
return $this->_queue->send(serialize($this));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.