1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/old-town/workflow-doctrine |
4
|
|
|
* @author Malofeykin Andrey <[email protected]> |
5
|
|
|
*/ |
6
|
|
|
namespace OldTown\Workflow\Spi\Doctrine\Entity; |
7
|
|
|
|
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class HistoryStep |
13
|
|
|
* |
14
|
|
|
* @package OldTown\Workflow\Spi\Doctrine\Entity |
15
|
|
|
* |
16
|
|
|
* @ORM\Entity(repositoryClass="\OldTown\Workflow\Spi\Doctrine\EntityRepository\StepRepository") |
17
|
|
|
*/ |
18
|
|
|
class HistoryStep extends AbstractStep implements HistoryStepInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @ORM\ManyToOne(targetEntity="AbstractEntry", inversedBy="historySteps") |
22
|
|
|
* @ORM\JoinColumn(name="entry_id", referencedColumnName="id") |
23
|
|
|
* |
24
|
|
|
* @var EntryInterface |
25
|
|
|
* |
26
|
|
|
*/ |
27
|
|
|
protected $entry; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param CurrentStepInterface $step |
31
|
|
|
* |
32
|
|
|
* @throws Exception\InvalidArgumentException |
33
|
|
|
*/ |
34
|
|
|
public function __construct(CurrentStepInterface $step) |
35
|
|
|
{ |
36
|
|
|
parent::__construct(); |
37
|
|
|
|
38
|
|
|
$this->setId($step->getId()); |
39
|
|
|
$this->setActionId($step->getActionId()); |
40
|
|
|
$this->setCaller($step->getCaller()); |
41
|
|
|
$this->setStatus($step->getStatus()); |
42
|
|
|
$this->setFinishDate($step->getFinishDate()); |
43
|
|
|
$this->setDueDate($step->getDueDate()); |
44
|
|
|
$this->setEntry($step->getEntry()); |
45
|
|
|
$this->setOwner($step->getOwner()); |
46
|
|
|
$this->setStartDate($step->getStartDate()); |
47
|
|
|
$this->setStepId($step->getStepId()); |
48
|
|
|
$this->setPreviousSteps($step->getPreviousSteps()); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return EntryInterface |
53
|
|
|
*/ |
54
|
|
|
public function getEntry() |
55
|
|
|
{ |
56
|
|
|
return $this->entry; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param EntryInterface $entry |
61
|
|
|
* |
62
|
|
|
* @return $this |
63
|
|
|
*/ |
64
|
|
|
public function setEntry(EntryInterface $entry) |
65
|
|
|
{ |
66
|
|
|
$this->entry = $entry; |
67
|
|
|
|
68
|
|
|
if (!$entry->getHistorySteps()->contains($this)) { |
69
|
|
|
$entry->getHistorySteps()->add($this); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
return $this; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|