3
namespace Xaav\QueueBundle\Entity;
5
use Xaav\QueueBundle\JobQueue\JobInterface;
6
use Xaav\QueueBundle\Exception\InvalidCallableException;
7
use Xaav\QueueBundle\JobQueue\JobCallableInterface;
8
use Doctrine\ORM\Mapping as ORM;
11
* @ORM\Entity(repositoryClass="Xaav\QueueBundle\Entity\JobRepository")
13
class Job implements JobInterface
17
* @ORM\Column(type="integer")
18
* @ORM\GeneratedValue(strategy="AUTO")
23
* @ORM\Column(type="string", length="1000")
28
* @ORM\ManyToOne(targetEntity="JobQueue", inversedBy="Job")
32
public function __construct(JobCallableInterface $callable = null)
36
$this->callable = serialize($callable);
40
public function execute()
42
$callable = unserialize($this->callable);
44
if($callable instanceof JobCallableInterface){
48
throw new InvalidCallableException($callable);
57
public function getId()
65
* @param string $callable
67
public function setCallable($callable)
69
$this->callable = $callable;
75
* @return string $callable
77
public function getCallable()
79
return $this->callable;
85
* @param Xaav\QueueBundle\Entity\JobQueue $jobQueue
87
public function setJobQueue(\Xaav\QueueBundle\Entity\JobQueue $jobQueue)
89
$this->jobQueue = $jobQueue;
95
* @return Xaav\QueueBundle\Entity\JobQueue $jobQueue
97
public function getJobQueue()
99
return $this->jobQueue;
b'\\ No newline at end of file'