Completed
Push — sf2.7 ( 8586ff...27ae11 )
by Laurent
03:38
created

Inventory   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 191
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 13
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 191
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getId() 0 4 1
A setDate() 0 6 1
A getDate() 0 4 1
A setFile() 0 6 1
A getFile() 0 4 1
A setAmount() 0 6 1
A getAmount() 0 4 1
A setStatus() 0 6 1
A getStatus() 0 4 1
A addArticle() 0 6 1
A removeArticle() 0 4 1
A getArticles() 0 4 1
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    since 1.0.0
12
 *
13
 * @link       https://github.com/Dev-Int/glsr
14
 */
15
namespace AppBundle\Entity;
16
17
use Doctrine\ORM\Mapping as ORM;
18
use Doctrine\Common\Collections\ArrayCollection;
19
use AppBundle\Entity\InventoryArticles;
20
21
/**
22
 * Inventory
23
 *
24
 * @category   Entity
25
 *
26
 * @ORM\Table(name="gs_inventory")
27
 * @ORM\Entity(repositoryClass="AppBundle\Entity\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 boolean
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
     * @var string
64
     *
65
     * @ORM\Column(name="file", type="text", nullable=true)
66
     */
67
    private $file;
68
69
    /**
70
     * @var string
71
     *
72
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\InventoryArticles", mappedBy="inventory")
73
     * @ORM\JoinColumn(nullable=false)
74
     */
75
    private $articles;
76
77
    public function __construct()
78
    {
79
        $this->articles = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type string of property $articles.

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...
80
        $this->date = new \DateTime();
81
        $this->amount = 0.000;
82
        $this->status = 1;
0 ignored issues
show
Documentation Bug introduced by
The property $status was declared of type boolean, but 1 is of type integer. 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...
83
    }
84
85
    /**
86
     * Get id
87
     *
88
     * @return integer 
89
     */
90
    public function getId()
91
    {
92
        return $this->id;
93
    }
94
95
    /**
96
     * Set date
97
     *
98
     * @param \DateTime $date
99
     * @return Inventory
100
     */
101
    public function setDate($date)
102
    {
103
        $this->date = $date;
104
105
        return $this;
106
    }
107
108
    /**
109
     * Get date
110
     *
111
     * @return \DateTime 
112
     */
113
    public function getDate()
114
    {
115
        return $this->date;
116
    }
117
118
    /**
119
     * Set file
120
     *
121
     * @param string $file
122
     * @return Inventory
123
     */
124
    public function setFile($file)
125
    {
126
        $this->file = $file;
127
128
        return $this;
129
    }
130
131
    /**
132
     * Get file
133
     *
134
     * @return string 
135
     */
136
    public function getFile()
137
    {
138
        return $this->file;
139
    }
140
141
    /**
142
     * Set amount
143
     *
144
     * @param string $amount
145
     * @return Inventory
146
     */
147
    public function setAmount($amount)
148
    {
149
        $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...
150
151
        return $this;
152
    }
153
154
    /**
155
     * Get amount
156
     *
157
     * @return string 
158
     */
159
    public function getAmount()
160
    {
161
        return $this->amount;
162
    }
163
164
    /**
165
     * Set status
166
     *
167
     * @param integer $status
168
     * @return Inventory
169
     */
170
    public function setStatus($status)
171
    {
172
        $this->status = $status;
0 ignored issues
show
Documentation Bug introduced by
The property $status was declared of type boolean, but $status is of type integer. 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...
173
174
        return $this;
175
    }
176
177
    /**
178
     * Get status
179
     *
180
     * @return integer 
181
     */
182
    public function getStatus()
183
    {
184
        return $this->status;
185
    }
186
187
    /**
188
     * Add articles
189
     *
190
     * @param \AppBundle\Entity\InventoryArticles $articles
191
     * @return Inventory
192
     */
193
    public function addArticle(InventoryArticles $articles)
194
    {
195
        $this->articles[] = $articles;
196
197
        return $this;
198
    }
199
200
    /**
201
     * Remove articles
202
     *
203
     * @param \AppBundle\Entity\InventoryArticles $articles
204
     */
205
    public function removeArticle(InventoryArticles $articles)
206
    {
207
        $this->articles->removeElement($articles);
0 ignored issues
show
Bug introduced by
The method removeElement cannot be called on $this->articles (of type string).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
208
    }
209
210
    /**
211
     * Get articles
212
     *
213
     * @return \Doctrine\Common\Collections\Collection 
214
     */
215
    public function getArticles()
216
    {
217
        return $this->articles;
218
    }
219
}
220