Completed
Branch master (fdcd72)
by Laurent
03:58
created

InventoryArticles::setZoneStorage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
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
7
/**
8
 * InventoryArticles
9
 *
10
 * @ORM\Table(name="gs_inventory_articles")
11
 * @ORM\Entity(repositoryClass="AppBundle\Entity\InventoryArticlesRepository")
12
 */
13
class InventoryArticles
14
{
15
    /**
16
     * @var integer
17
     *
18
     * @ORM\Column(name="id", type="integer")
19
     * @ORM\Id
20
     * @ORM\GeneratedValue(strategy="AUTO")
21
     */
22
    private $id;
23
24
    /**
25
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Inventory", inversedBy="articles")
26
     * @ORM\JoinColumn(nullable=false)
27
     */
28
    private $inventory;
29
30
    /**
31
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Article")
32
     * @ORM\JoinColumn(nullable=false)
33
     */
34
    private $article;
35
36
    /**
37
     * @var decimal Quantité en stock
38
     *
39
     * @ORM\Column(name="quantity", type="decimal", precision=7, scale=3)
40
     */
41
    private $quantity;
42
43
    /**
44
     * @var string
45
     *
46
     * @ORM\Column(name="realstock", type="decimal", precision=7, scale=3, options={"default" = 0})
47
     */
48
    private $realstock;
49
50
    /**
51
     * @var string Unité de stockage
52
     *
53
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\UnitStorage")
54
     * @ORM\JoinColumn(nullable=false)
55
     */
56
    private $unit_storage;
57
58
    /**
59
     * @var string
60
     *
61
     * @ORM\Column(name="price", type="decimal", precision=7, scale=3, nullable=true)
62
     */
63
    private $price;
64
65
66
    /**
67
     * Get id
68
     *
69
     * @return integer
70
     */
71
    public function getId()
72
    {
73
        return $this->id;
74
    }
75
76
    /**
77
     * Set inventory
78
     *
79
     * @param \AppBundle\Entity\Inventory $inventory
80
     * @return InventoryArticles
81
     */
82
    public function setInventory(\AppBundle\Entity\Inventory $inventory)
83
    {
84
        $this->inventory = $inventory;
85
86
        return $this;
87
    }
88
89
    /**
90
     * Get inventory
91
     *
92
     * @return string
93
     */
94
    public function getInventory()
95
    {
96
        return $this->inventory;
97
    }
98
99
    /**
100
     * Set article
101
     *
102
     * @param \AppBundle\Entity\Article $article
103
     * @return InventoryArticles
104
     */
105
    public function setArticle(\AppBundle\Entity\Article $article)
106
    {
107
        $this->article = $article;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Get article
114
     *
115
     * @return string
116
     */
117
    public function getArticle()
118
    {
119
        return $this->article;
120
    }
121
122
    /**
123
     * Set realstock
124
     *
125
     * @param string $realstock
126
     * @return InventoryArticles
127
     */
128
    public function setRealstock($realstock)
129
    {
130
        $this->realstock = $realstock;
131
132
        return $this;
133
    }
134
135
    /**
136
     * Get realstock
137
     *
138
     * @return string
139
     */
140
    public function getRealstock()
141
    {
142
        return $this->realstock;
143
    }
144
145
    /**
146
     * Set Price
147
     *
148
     * @param string $price
149
     * @return InventoryArticles
150
     */
151
    public function setPrice($price)
152
    {
153
        $this->price = $price;
154
155
        return $this;
156
    }
157
158
    /**
159
     * Get Price
160
     *
161
     * @return string
162
     */
163
    public function getPrice()
164
    {
165
        return $this->price;
166
    }
167
168
    /**
169
     * Set quantity
170
     *
171
     * @param string $quantity
172
     * @return InventoryArticles
173
     */
174
    public function setQuantity($quantity)
175
    {
176
        $this->quantity = $quantity;
0 ignored issues
show
Documentation Bug introduced by
It seems like $quantity of type string is incompatible with the declared type object<AppBundle\Entity\decimal> of property $quantity.

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..

Loading history...
177
178
        return $this;
179
    }
180
181
    /**
182
     * Get quantity
183
     *
184
     * @return string
185
     */
186
    public function getQuantity()
187
    {
188
        return $this->quantity;
189
    }
190
191
    /**
192
     * Set unit_storage
193
     *
194
     * @param \AppBundle\Entity\UnitStorage $unitStorage
195
     * @return InventoryArticles
196
     */
197
    public function setUnitStorage(\AppBundle\Entity\UnitStorage $unitStorage = null)
198
    {
199
        $this->unit_storage = $unitStorage;
0 ignored issues
show
Documentation Bug introduced by
It seems like $unitStorage can also be of type object<AppBundle\Entity\UnitStorage>. However, the property $unit_storage is declared as type string. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
200
201
        return $this;
202
    }
203
204
    /**
205
     * Get unit_storage
206
     *
207
     * @return \AppBundle\Entity\UnitStorage
208
     */
209
    public function getUnitStorage()
210
    {
211
        return $this->unit_storage;
212
    }
213
214
    /**
215
     * Constructor
216
     */
217
    public function __construct()
218
    {
219
    }
220
221
    /**
222
     * Set zone_storage
223
     *
224
     * @param integer $zoneStorage
225
     * @return InventoryArticles
226
     */
227
    public function setZoneStorage($zoneStorage)
228
    {
229
        $this->zone_storage = $zoneStorage;
0 ignored issues
show
Bug introduced by
The property zone_storage 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...
230
231
        return $this;
232
    }
233
234
    /**
235
     * Get zone_storage
236
     *
237
     * @return integer
238
     */
239
    public function getZoneStorage()
240
    {
241
        return $this->zone_storage;
242
    }
243
}
244