1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* (c) fduch <[email protected]> |
9
|
|
|
* @date 27.07.16 |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Gtt\Bundle\WorkflowExtensionsBundle\Entity; |
13
|
|
|
|
14
|
|
|
use Doctrine\ORM\Mapping as ORM; |
15
|
|
|
use Gtt\Bundle\WorkflowExtensionsBundle\Exception\InvalidArgumentException; |
16
|
|
|
use JMS\JobQueueBundle\Entity\Job; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Persists information about scheduled transition (as jms Job) for specified workflow and subject |
20
|
|
|
* and allows to fetch it in order to manipulate or re-schedule |
21
|
|
|
* @see Job |
22
|
|
|
* |
23
|
|
|
* @ORM\Entity(repositoryClass = "Gtt\Bundle\WorkflowExtensionsBundle\Entity\Repository\ScheduledJobRepository") |
24
|
|
|
* |
25
|
|
|
* @ORM\Table(name = "gtt_workflow_scheduled_job") |
26
|
|
|
* |
27
|
|
|
* (c) fduch <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
class ScheduledJob |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* Autogenerated id |
33
|
|
|
* |
34
|
|
|
* @var int |
35
|
|
|
* |
36
|
|
|
* @ORM\Id |
37
|
|
|
* @ORM\GeneratedValue(strategy = "AUTO") |
38
|
|
|
* @ORM\Column(type = "integer", options = {"unsigned": true}) |
39
|
|
|
*/ |
40
|
|
|
private $id; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Reschedulable or not |
44
|
|
|
* |
45
|
|
|
* @var boolean |
46
|
|
|
* |
47
|
|
|
* @ORM\Column(type = "boolean") |
48
|
|
|
*/ |
49
|
|
|
private $reschedulable; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Related jms Job to be executed later |
53
|
|
|
* |
54
|
|
|
* @var Job |
55
|
|
|
* |
56
|
|
|
* @ORM\OneToOne(targetEntity="JMS\JobQueueBundle\Entity\Job") |
57
|
|
|
* @ORM\JoinColumn(name="jms_job_id", referencedColumnName="id", nullable=false) |
58
|
|
|
*/ |
59
|
|
|
private $job; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* ScheduledJob constructor. |
63
|
|
|
* |
64
|
|
|
* @param Job $transitionTriggerJob transition trigger job |
65
|
|
|
* @param boolean $reschedulable reschedulable or not |
66
|
|
|
*/ |
67
|
|
|
public function __construct(Job $transitionTriggerJob, $reschedulable = true) |
68
|
|
|
{ |
69
|
|
|
$this->reschedulable = $reschedulable; |
70
|
|
|
$this->job = $transitionTriggerJob; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Returns id |
76
|
|
|
* |
77
|
|
|
* @return int |
78
|
|
|
*/ |
79
|
|
|
public function getId() |
80
|
|
|
{ |
81
|
|
|
return $this->id; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return boolean |
86
|
|
|
*/ |
87
|
|
|
public function getReschedulable() |
88
|
|
|
{ |
89
|
|
|
return $this->reschedulable; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param boolean $reschedulable |
94
|
|
|
*/ |
95
|
|
|
public function setReschedulable($reschedulable) |
96
|
|
|
{ |
97
|
|
|
$this->reschedulable = $reschedulable; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Returns Job |
102
|
|
|
* |
103
|
|
|
* @return Job |
104
|
|
|
*/ |
105
|
|
|
public function getJob() |
106
|
|
|
{ |
107
|
|
|
return $this->job; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Sets Job |
112
|
|
|
* |
113
|
|
|
* @param Job $job Related jms job |
114
|
|
|
* |
115
|
|
|
* @return ScheduledJob |
116
|
|
|
*/ |
117
|
|
|
public function setJob($job) |
118
|
|
|
{ |
119
|
|
|
$this->job = $job; |
120
|
|
|
|
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
} |