1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SolutionDrive\SyliusProductBundlesPlugin\Entity; |
6
|
|
|
|
7
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
8
|
|
|
use Doctrine\Common\Collections\Collection; |
9
|
|
|
use Sylius\Component\Core\Model\ProductInterface; |
10
|
|
|
use Sylius\Component\Resource\Model\CodeAwareInterface; |
11
|
|
|
use Sylius\Component\Resource\Model\ResourceInterface; |
12
|
|
|
|
13
|
|
|
class ProductBundle implements ProductBundleInterface, ResourceInterface, CodeAwareInterface |
14
|
|
|
{ |
15
|
|
|
/** @var int */ |
16
|
|
|
private $id; |
17
|
|
|
|
18
|
|
|
/** @var string|null */ |
19
|
|
|
private $code; |
20
|
|
|
|
21
|
|
|
/** @var string */ |
22
|
|
|
private $name; |
23
|
|
|
|
24
|
|
|
/** @var Collection */ |
25
|
|
|
private $products; |
26
|
|
|
|
27
|
|
|
/** @var ProductInterface */ |
28
|
|
|
private $product; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* ProductBundle constructor. |
32
|
|
|
*/ |
33
|
|
|
public function __construct() |
34
|
|
|
{ |
35
|
|
|
$this->products = new ArrayCollection(); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return int |
40
|
|
|
*/ |
41
|
|
|
public function getId(): int |
42
|
|
|
{ |
43
|
|
|
return $this->id; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return string|null |
48
|
|
|
*/ |
49
|
|
|
public function getCode(): ?string |
50
|
|
|
{ |
51
|
|
|
return $this->code; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param string|null $code |
56
|
|
|
*/ |
57
|
|
|
public function setCode(?string $code): void |
58
|
|
|
{ |
59
|
|
|
$this->code = $code; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return string |
64
|
|
|
*/ |
65
|
|
|
public function getName(): ?string |
66
|
|
|
{ |
67
|
|
|
return $this->name; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $name |
72
|
|
|
*/ |
73
|
|
|
public function setName(?string $name): void |
74
|
|
|
{ |
75
|
|
|
$this->name = $name; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param ProductInterface $product |
80
|
|
|
*/ |
81
|
|
|
public function addProduct(ProductInterface $product): void |
82
|
|
|
{ |
83
|
|
|
$this->products->add($product); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return Collection |
88
|
|
|
*/ |
89
|
|
|
public function getProducts(): Collection |
90
|
|
|
{ |
91
|
|
|
return $this->products; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return ProductInterface |
96
|
|
|
*/ |
97
|
|
|
public function getProduct(): ProductInterface |
98
|
|
|
{ |
99
|
|
|
return $this->product; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param ProductInterface $product |
104
|
|
|
*/ |
105
|
|
|
public function setProduct(ProductInterface $product): void |
106
|
|
|
{ |
107
|
|
|
$this->product = $product; |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..