1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Entité Inventory. |
4
|
|
|
* |
5
|
|
|
* PHP Version 5 |
6
|
|
|
* |
7
|
|
|
* @author Quétier Laurent <[email protected]> |
8
|
|
|
* @copyright 2014 Dev-Int GLSR |
9
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License |
10
|
|
|
* |
11
|
|
|
* @version GIT: <git_id> |
12
|
|
|
* |
13
|
|
|
* @link https://github.com/Dev-Int/glsr |
14
|
|
|
*/ |
15
|
|
|
namespace AppBundle\Entity\Stocks; |
16
|
|
|
|
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
18
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
19
|
|
|
use AppBundle\Entity\Stocks\InventoryArticles; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Inventory |
23
|
|
|
* |
24
|
|
|
* @category Entity |
25
|
|
|
* |
26
|
|
|
* @ORM\Table(name="gs_inventory") |
27
|
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\Stocks\InventoryRepository") |
28
|
|
|
*/ |
29
|
|
|
class Inventory |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var integer |
33
|
|
|
* |
34
|
|
|
* @ORM\Column(name="id", type="integer") |
35
|
|
|
* @ORM\Id |
36
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
37
|
|
|
*/ |
38
|
|
|
private $id; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var \DateTime |
42
|
|
|
* |
43
|
|
|
* @ORM\Column(name="date", type="datetime") |
44
|
|
|
*/ |
45
|
|
|
private $date; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var integer |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(name="status", type="smallint") |
51
|
|
|
*/ |
52
|
|
|
private $status; |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var float Montant de l'inventaire |
57
|
|
|
* |
58
|
|
|
* @ORM\Column(name="amount", type="decimal", precision=7, scale=3, nullable=true) |
59
|
|
|
*/ |
60
|
|
|
private $amount; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Stocks\InventoryArticles", mappedBy="inventory") |
64
|
|
|
* @ORM\JoinColumn(nullable=false) |
65
|
|
|
*/ |
66
|
|
|
private $articles; |
67
|
|
|
|
68
|
|
|
public function __construct() |
69
|
|
|
{ |
70
|
|
|
$this->articles = new ArrayCollection(); |
71
|
|
|
$this->date = new \DateTime(); |
72
|
|
|
$this->amount = 0.000; |
73
|
|
|
$this->status = 1; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get id |
78
|
|
|
* |
79
|
|
|
* @return integer |
80
|
|
|
*/ |
81
|
|
|
public function getId() |
82
|
|
|
{ |
83
|
|
|
return $this->id; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Set date |
88
|
|
|
* |
89
|
|
|
* @param \DateTime $date |
90
|
|
|
* @return Inventory |
91
|
|
|
*/ |
92
|
|
|
public function setDate(\DateTime $date) |
93
|
|
|
{ |
94
|
|
|
$this->date = $date; |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Get date |
101
|
|
|
* |
102
|
|
|
* @return \DateTime |
103
|
|
|
*/ |
104
|
|
|
public function getDate() |
105
|
|
|
{ |
106
|
|
|
return $this->date; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Set amount |
111
|
|
|
* |
112
|
|
|
* @param float $amount |
113
|
|
|
* @return Inventory |
114
|
|
|
*/ |
115
|
|
|
public function setAmount($amount) |
116
|
|
|
{ |
117
|
|
|
$this->amount = $amount; |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get amount |
124
|
|
|
* |
125
|
|
|
* @return double |
126
|
|
|
*/ |
127
|
|
|
public function getAmount() |
128
|
|
|
{ |
129
|
|
|
return $this->amount; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Set status |
134
|
|
|
* |
135
|
|
|
* @param integer $status |
136
|
|
|
* @return Inventory |
137
|
|
|
*/ |
138
|
|
|
public function setStatus($status) |
139
|
|
|
{ |
140
|
|
|
$this->status = $status; |
141
|
|
|
|
142
|
|
|
return $this; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Get status |
147
|
|
|
* |
148
|
|
|
* @return integer |
149
|
|
|
*/ |
150
|
|
|
public function getStatus() |
151
|
|
|
{ |
152
|
|
|
return $this->status; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Add articles |
157
|
|
|
* |
158
|
|
|
* @param \AppBundle\Entity\Stocks\InventoryArticles $articles |
159
|
|
|
* @return Inventory |
160
|
|
|
*/ |
161
|
|
|
public function addArticle(InventoryArticles $articles) |
162
|
|
|
{ |
163
|
|
|
$this->articles[] = $articles; |
164
|
|
|
|
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Remove articles |
170
|
|
|
* |
171
|
|
|
* @param \AppBundle\Entity\Stocks\InventoryArticles $articles |
172
|
|
|
*/ |
173
|
|
|
public function removeArticle(InventoryArticles $articles) |
174
|
|
|
{ |
175
|
|
|
$this->articles->removeElement($articles); |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Get articles |
180
|
|
|
* |
181
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection |
182
|
|
|
*/ |
183
|
|
|
public function getArticles() |
184
|
|
|
{ |
185
|
|
|
return $this->articles; |
186
|
|
|
} |
187
|
|
|
} |
188
|
|
|
|