1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Loevgaard\DandomainConsignment\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Loevgaard\DandomainStock\Entity\Generated\StockMovementInterface; |
7
|
|
|
|
8
|
|
|
trait ManufacturerTrait |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var boolean |
12
|
|
|
* |
13
|
|
|
* @ORM\Column(type="boolean") |
14
|
|
|
*/ |
15
|
|
|
protected $consignment = false; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string|null |
19
|
|
|
* |
20
|
|
|
* @ORM\Column(type="string", nullable=true, length=191) |
21
|
|
|
*/ |
22
|
|
|
protected $consignmentClass; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* This is the last stock movement used in reports |
26
|
|
|
* This implies that stock movements can't be changed |
27
|
|
|
* |
28
|
|
|
* @var StockMovementInterface|null |
29
|
|
|
* |
30
|
|
|
* @ORM\ManyToOne(targetEntity="Loevgaard\DandomainStock\Entity\StockMovement") |
31
|
|
|
*/ |
32
|
|
|
protected $consignmentLastStockMovement; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return bool |
36
|
|
|
*/ |
37
|
|
|
public function isConsignment(): bool |
38
|
|
|
{ |
39
|
|
|
return (bool)$this->consignment; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param bool $consignment |
44
|
|
|
* @return ManufacturerTrait |
|
|
|
|
45
|
|
|
*/ |
46
|
|
|
public function setConsignment(bool $consignment) |
47
|
|
|
{ |
48
|
|
|
$this->consignment = $consignment; |
49
|
|
|
return $this; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
|
|
public function getConsignmentClass(): ?string |
56
|
|
|
{ |
57
|
|
|
return $this->consignmentClass; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @param string|null $consignmentClass |
62
|
|
|
* @return ManufacturerTrait |
|
|
|
|
63
|
|
|
*/ |
64
|
|
|
public function setConsignmentClass(?string $consignmentClass) |
65
|
|
|
{ |
66
|
|
|
$this->consignmentClass = $consignmentClass; |
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return StockMovementInterface|null |
72
|
|
|
*/ |
73
|
|
|
public function getConsignmentLastStockMovement(): ?StockMovementInterface |
74
|
|
|
{ |
75
|
|
|
return $this->consignmentLastStockMovement; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param StockMovementInterface|null $consignmentLastStockMovement |
80
|
|
|
* @return ManufacturerTrait |
|
|
|
|
81
|
|
|
*/ |
82
|
|
|
public function setConsignmentLastStockMovement(?StockMovementInterface $consignmentLastStockMovement) |
83
|
|
|
{ |
84
|
|
|
$this->consignmentLastStockMovement = $consignmentLastStockMovement; |
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
} |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.