Completed
Push — master ( 31ac84...e79cb7 )
by Laurent
12:51 queued 09:39
created

Orders::setAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Symfony\Component\Validator\Constraints as Assert;
7
use Doctrine\Common\Collections\ArrayCollection;
8
use AppBundle\Entity\Supplier;
9
use AppBundle\Entity\OrdersArticles;
10
11
/**
12
 * Orders
13
 *
14
 * @ORM\Table(name="gs_orders")
15
 * @ORM\Entity(repositoryClass="AppBundle\Entity\OrdersRepository")
16
 */
17
class Orders
18
{
19
    /**
20
     * @var int
21
     *
22
     * @ORM\Column(name="id", type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue(strategy="AUTO")
25
     */
26
    private $id;
27
28
    /**
29
     * @var string|\AppBundle\Entity\Supplier Nom du fournisseur
30
     *
31
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Supplier")
32
     */
33
    private $supplier;
34
35
    /**
36
     * @var \DateTime Date de commande
37
     *
38
     * @ORM\Column(name="order_date", type="datetime")
39
     */
40
    private $orderdate;
41
42
    /**
43
     * @var \DateTime Date de livraison
44
     *
45
     * @ORM\Column(name="deliv_date", type="datetime")
46
     */
47
    private $delivdate;
48
49
    /**
50
     * @var float Montant de la commande
51
     *
52
     * @ORM\Column(name="amount", type="decimal", precision=7, scale=3, nullable=true)
53
     * @Assert\Type(type="numeric",
54
     * message="La valeur {{ value }} n'est pas un type {{ type }} valide.")
55
     */
56
    private $amount;
57
58
    /**
59
     * @var float Montant de la tva
60
     *
61
     * @ORM\Column(name="tva", type="decimal", precision=7, scale=3, nullable=true)
62
     */
63
    private $tva;
64
65
    /**
66
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\OrdersArticles", mappedBy="orders")
67
     * @ORM\JoinColumn(nullable=false)
68
     */
69
    private $articles;
70
71
    /**
72
     * @var integer
73
     *
74
     * @ORM\Column(name="status", type="smallint")
75
     */
76
    private $status;
77
78
    public function __construct()
79
    {
80
        $this->articles = new ArrayCollection();
81
        $this->orderdate = new \DateTime();
82
        $this->delivdate = new \DateTime();
83
        $this->amount = 0.000;
84
        $this->tva = 0.000;
85
        $this->status = 1;
86
    }
87
88
89
    /**
90
     * Get id
91
     *
92
     * @return integer
93
     */
94
    public function getId()
95
    {
96
        return $this->id;
97
    }
98
99
    /**
100
     * Set orderdate
101
     *
102
     * @param \DateTime $orderdate
103
     * @return Orders
104
     */
105
    public function setOrderdate(\DateTime $orderdate)
106
    {
107
        $this->orderdate = $orderdate;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Get orderdate
114
     *
115
     * @return \DateTime
116
     */
117
    public function getOrderdate()
118
    {
119
        return $this->orderdate;
120
    }
121
122
    /**
123
     * Set delivdate
124
     *
125
     * @param \DateTime $delivdate
126
     * @return Orders
127
     */
128
    public function setDelivdate(\DateTime $delivdate)
129
    {
130
        $this->delivdate = $delivdate;
131
132
        return $this;
133
    }
134
135
    /**
136
     * Get delivdate
137
     *
138
     * @return \DateTime
139
     */
140
    public function getDelivdate()
141
    {
142
        return $this->delivdate;
143
    }
144
145
    /**
146
     * Set amount
147
     *
148
     * @param string $amount
149
     * @return Orders
150
     */
151
    public function setAmount($amount)
152
    {
153
        $this->amount = $amount;
0 ignored issues
show
Documentation Bug introduced by
The property $amount was declared of type double, but $amount is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
154
155
        return $this;
156
    }
157
158
    /**
159
     * Get amount
160
     *
161
     * @return string
162
     */
163
    public function getAmount()
164
    {
165
        return $this->amount;
166
    }
167
168
    /**
169
     * Set tva
170
     *
171
     * @param string $tva
172
     * @return Orders
173
     */
174
    public function setTva($tva)
175
    {
176
        $this->tva = $tva;
0 ignored issues
show
Documentation Bug introduced by
The property $tva was declared of type double, but $tva is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
177
178
        return $this;
179
    }
180
181
    /**
182
     * Get tva
183
     *
184
     * @return string
185
     */
186
    public function getTva()
187
    {
188
        return $this->tva;
189
    }
190
191
    /**
192
     * Set status
193
     *
194
     * @param integer $status
195
     * @return Orders
196
     */
197
    public function setStatus($status)
198
    {
199
        $this->status = $status;
200
201
        return $this;
202
    }
203
204
    /**
205
     * Get status
206
     *
207
     * @return integer
208
     */
209
    public function getStatus()
210
    {
211
        return $this->status;
212
    }
213
214
    /**
215
     * Set supplier
216
     *
217
     * @param \AppBundle\Entity\Supplier $supplier
218
     * @return Orders
219
     */
220
    public function setSupplier(Supplier $supplier = null)
221
    {
222
        $this->supplier = $supplier;
223
224
        return $this;
225
    }
226
227
    /**
228
     * Get supplier
229
     *
230
     * @return \AppBundle\Entity\Supplier
231
     */
232
    public function getSupplier()
233
    {
234
        return $this->supplier;
235
    }
236
237
    /**
238
     * Add articles
239
     *
240
     * @param \AppBundle\Entity\OrdersArticles $articles
241
     * @return Orders
242
     */
243
    public function addArticle(OrdersArticles $articles)
244
    {
245
        $this->articles[] = $articles;
246
247
        return $this;
248
    }
249
250
    /**
251
     * Remove articles
252
     *
253
     * @param \AppBundle\Entity\OrdersArticles $articles
254
     */
255
    public function removeArticle(OrdersArticles $articles)
256
    {
257
        $this->articles->removeElement($articles);
258
    }
259
260
    /**
261
     * Get articles
262
     *
263
     * @return \Doctrine\Common\Collections\Collection
264
     */
265
    public function getArticles()
266
    {
267
        return $this->articles;
268
    }
269
270
    /**
271
     * Cette méthode permet de faire "echo $orders".
272
     * <p>Ainsi, pour "afficher" $orders,
273
     * PHP affichera en réalité le retour de cette méthode.<br />
274
     * Ici, le nom, donc "echo $orders"
275
     * est équivalent à "echo $orders->getName()".</p>
276
     *
277
     * @return string name
278
     */
279
    public function __toString()
280
    {
281
        return $this->name;
0 ignored issues
show
Bug introduced by
The property name does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
282
    }
283
}
284