Completed
Push — master ( 1af8b6...90bc50 )
by Laurent
03:35
created

Orders   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 253
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 17
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 253
rs 10

17 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getId() 0 4 1
A setOrderdate() 0 6 1
A getOrderdate() 0 4 1
A setDelivdate() 0 6 1
A getDelivdate() 0 4 1
A setAmount() 0 6 1
A getAmount() 0 4 1
A setTva() 0 6 1
A getTva() 0 4 1
A setStatus() 0 6 1
A getStatus() 0 4 1
A setSupplier() 0 6 1
A getSupplier() 0 4 1
A addArticle() 0 6 1
A removeArticle() 0 4 1
A getArticles() 0 4 1
1
<?php
2
3
/**
4
 * Entité Orders.
5
 *
6
 * PHP Version 5
7
 *
8
 * @author    Quétier Laurent <[email protected]>
9
 * @copyright 2014 Dev-Int GLSR
10
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
11
 *
12
 * @version GIT: <git_id>
13
 *
14
 * @link https://github.com/Dev-Int/glsr
15
 */
16
namespace AppBundle\Entity\Orders;
17
18
use Doctrine\ORM\Mapping as ORM;
19
use Symfony\Component\Validator\Constraints as Assert;
20
use Doctrine\Common\Collections\ArrayCollection;
21
use AppBundle\Entity\Supplier;
22
use AppBundle\Entity\Orders\OrdersArticles;
23
24
/**
25
 * Orders
26
 *
27
 * @ORM\Table(name="gs_orders")
28
 * @ORM\Entity(repositoryClass="AppBundle\Repository\Orders\OrdersRepository")
29
 */
30
class Orders
31
{
32
    /**
33
     * @var int
34
     *
35
     * @ORM\Column(name="id", type="integer")
36
     * @ORM\Id
37
     * @ORM\GeneratedValue(strategy="AUTO")
38
     */
39
    private $id;
40
41
    /**
42
     * @var string|\AppBundle\Entity\Supplier Nom du fournisseur
43
     *
44
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Settings\Supplier")
45
     */
46
    private $supplier;
47
48
    /**
49
     * @var \DateTime Date de commande
50
     *
51
     * @ORM\Column(name="order_date", type="datetime")
52
     */
53
    private $orderdate;
54
55
    /**
56
     * @var \DateTime Date de livraison
57
     *
58
     * @ORM\Column(name="deliv_date", type="datetime")
59
     */
60
    private $delivdate;
61
62
    /**
63
     * @var float Montant de la commande
64
     *
65
     * @ORM\Column(name="amount", type="decimal", precision=7, scale=3, nullable=true)
66
     * @Assert\Type(type="numeric",
67
     * message="La valeur {{ value }} n'est pas un type {{ type }} valide.")
68
     */
69
    private $amount;
70
71
    /**
72
     * @var float Montant de la tva
73
     *
74
     * @ORM\Column(name="tva", type="decimal", precision=7, scale=3, nullable=true)
75
     */
76
    private $tva;
77
78
    /**
79
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\Orders\OrdersArticles", mappedBy="orders")
80
     * @ORM\JoinColumn(nullable=false)
81
     */
82
    private $articles;
83
84
    /**
85
     * @var integer
86
     *
87
     * @ORM\Column(name="status", type="smallint")
88
     */
89
    private $status;
90
91
    public function __construct()
92
    {
93
        $this->articles = new ArrayCollection();
94
        $this->orderdate = new \DateTime();
95
        $this->delivdate = new \DateTime();
96
        $this->amount = 0.000;
97
        $this->tva = 0.000;
98
        $this->status = 1;
99
    }
100
101
102
    /**
103
     * Get id
104
     *
105
     * @return integer
106
     */
107
    public function getId()
108
    {
109
        return $this->id;
110
    }
111
112
    /**
113
     * Set orderdate
114
     *
115
     * @param \DateTime $orderdate
116
     * @return Orders
117
     */
118
    public function setOrderdate(\DateTime $orderdate)
119
    {
120
        $this->orderdate = $orderdate;
121
122
        return $this;
123
    }
124
125
    /**
126
     * Get orderdate
127
     *
128
     * @return \DateTime
129
     */
130
    public function getOrderdate()
131
    {
132
        return $this->orderdate;
133
    }
134
135
    /**
136
     * Set delivdate
137
     *
138
     * @param \DateTime $delivdate
139
     * @return Orders
140
     */
141
    public function setDelivdate(\DateTime $delivdate)
142
    {
143
        $this->delivdate = $delivdate;
144
145
        return $this;
146
    }
147
148
    /**
149
     * Get delivdate
150
     *
151
     * @return \DateTime
152
     */
153
    public function getDelivdate()
154
    {
155
        return $this->delivdate;
156
    }
157
158
    /**
159
     * Set amount
160
     *
161
     * @param string $amount
162
     * @return Orders
163
     */
164
    public function setAmount($amount)
165
    {
166
        $this->amount = (double)$amount;
167
168
        return $this;
169
    }
170
171
    /**
172
     * Get amount
173
     *
174
     * @return string
175
     */
176
    public function getAmount()
177
    {
178
        return $this->amount;
179
    }
180
181
    /**
182
     * Set tva
183
     *
184
     * @param string $tva
185
     * @return Orders
186
     */
187
    public function setTva($tva)
188
    {
189
        $this->tva = (double)$tva;
190
191
        return $this;
192
    }
193
194
    /**
195
     * Get tva
196
     *
197
     * @return string
198
     */
199
    public function getTva()
200
    {
201
        return $this->tva;
202
    }
203
204
    /**
205
     * Set status
206
     *
207
     * @param integer $status
208
     * @return Orders
209
     */
210
    public function setStatus($status)
211
    {
212
        $this->status = $status;
213
214
        return $this;
215
    }
216
217
    /**
218
     * Get status
219
     *
220
     * @return integer
221
     */
222
    public function getStatus()
223
    {
224
        return $this->status;
225
    }
226
227
    /**
228
     * Set supplier
229
     *
230
     * @param \AppBundle\Entity\Settings\Supplier $supplier
231
     * @return Orders
232
     */
233
    public function setSupplier(Supplier $supplier = null)
234
    {
235
        $this->supplier = $supplier;
236
237
        return $this;
238
    }
239
240
    /**
241
     * Get supplier
242
     *
243
     * @return \AppBundle\Entity\Settings\Supplier
244
     */
245
    public function getSupplier()
246
    {
247
        return $this->supplier;
248
    }
249
250
    /**
251
     * Add articles
252
     *
253
     * @param \AppBundle\Entity\Orders\OrdersArticles $articles
254
     * @return Orders
255
     */
256
    public function addArticle(OrdersArticles $articles)
257
    {
258
        $this->articles[] = $articles;
259
260
        return $this;
261
    }
262
263
    /**
264
     * Remove articles
265
     *
266
     * @param \AppBundle\Entity\Orders\OrdersArticles $articles
267
     */
268
    public function removeArticle(OrdersArticles $articles)
269
    {
270
        $this->articles->removeElement($articles);
271
    }
272
273
    /**
274
     * Get articles
275
     *
276
     * @return \Doctrine\Common\Collections\Collection
277
     */
278
    public function getArticles()
279
    {
280
        return $this->articles;
281
    }
282
}
283