Completed
Push — master ( 5e4f38...1af8b6 )
by Laurent
08:07 queued 04:24
created

Material   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 208
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 14
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 208
rs 10

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getId() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A setActive() 0 6 1
A isActive() 0 4 1
A setMultiple() 0 6 1
A isMultiple() 0 4 1
A setUnitStorage() 0 6 1
A getUnitStorage() 0 4 1
A addArticle() 0 6 1
A removeArticle() 0 4 1
A getArticles() 0 4 1
A getSlug() 0 4 1
1
<?php
2
3
/**
4
 * Entité Material.
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\Config;
17
18
use Doctrine\ORM\Mapping as ORM;
19
use Symfony\Component\Validator\Constraints as Assert;
20
use Gedmo\Mapping\Annotation as Gedmo;
21
use Doctrine\Common\Collections\ArrayCollection;
22
use AppBundle\Entity\UnitStorage;
23
use AppBundle\Entity\Article;
24
25
/**
26
 * Material
27
 *
28
 * @ORM\Table(name="gs_material")
29
 * @ORM\Entity(repositoryClass="AppBundle\Repository\Config\MaterialRepository")
30
 */
31
class Material
32
{
33
    /**
34
     * @var int
35
     *
36
     * @ORM\Column(name="id", type="integer")
37
     * @ORM\Id
38
     * @ORM\GeneratedValue(strategy="AUTO")
39
     */
40
    private $id;
41
42
    /**
43
     * @var string
44
     *
45
     * @ORM\Column(name="name", type="string", unique=true)
46
     */
47
    private $name;
48
49
    /**
50
     * @var string|\AppBundle\Entity\UnitStorage Unité de stockage
51
     *
52
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\UnitStorage")
53
     */
54
    private $unitStorage;
55
56
    /**
57
     * @var bool
58
     *
59
     * @ORM\Column(name="active", type="boolean")
60
     */
61
    private $active;
62
63
    /**
64
     * @var bool
65
     *
66
     * @ORM\Column(name="multiple", type="boolean")
67
     */
68
    private $multiple;
69
70
    /**
71
     * @var \Doctrine\Common\Collections\ArrayCollection Article(s)
72
     *
73
     * @ORM\ManyToMany(targetEntity="AppBundle\Entity\Article")
74
     * @ORM\JoinTable(name="gs_material_article")
75
     * @Assert\NotBlank()
76
     */
77
    private $articles;
78
79
    /**
80
     * @Gedmo\Slug(fields={"name"}, updatable=false)
81
     * @ORM\Column(length=128, unique=true)
82
     */
83
    private $slug;
84
85
86
    /**
87
     * Constructor.
88
     */
89
    public function __construct()
90
    {
91
        $this->articles = new ArrayCollection();
92
    }
93
94
    /**
95
     * Get id
96
     *
97
     * @return integer
98
     */
99
    public function getId()
100
    {
101
        return $this->id;
102
    }
103
104
    /**
105
     * Set name
106
     *
107
     * @param string $name
108
     * @return Material
109
     */
110
    public function setName($name)
111
    {
112
        $this->name = $name;
113
114
        return $this;
115
    }
116
117
    /**
118
     * Get name
119
     *
120
     * @return string
121
     */
122
    public function getName()
123
    {
124
        return $this->name;
125
    }
126
127
    /**
128
     * Set active
129
     *
130
     * @param boolean $active
131
     * @return Material
132
     */
133
    public function setActive($active)
134
    {
135
        $this->active = $active;
136
137
        return $this;
138
    }
139
140
    /**
141
     * Get active
142
     *
143
     * @return boolean
144
     */
145
    public function isActive()
146
    {
147
        return $this->active;
148
    }
149
150
    /**
151
     * Set multiple
152
     *
153
     * @param boolean $multiple
154
     * @return Material
155
     */
156
    public function setMultiple($multiple)
157
    {
158
        $this->multiple = $multiple;
159
160
        return $this;
161
    }
162
163
    /**
164
     * Get multiple
165
     *
166
     * @return boolean
167
     */
168
    public function isMultiple()
169
    {
170
        return $this->multiple;
171
    }
172
173
    /**
174
     * Set unitStorage
175
     *
176
     * @param \AppBundle\Entity\UnitStorage $unitStorage
177
     * @return Material
178
     */
179
    public function setUnitStorage(UnitStorage $unitStorage = null)
180
    {
181
        $this->unitStorage = $unitStorage;
182
183
        return $this;
184
    }
185
186
    /**
187
     * Get unitStorage
188
     *
189
     * @return \AppBundle\Entity\UnitStorage
190
     */
191
    public function getUnitStorage()
192
    {
193
        return $this->unitStorage;
194
    }
195
196
    /**
197
     * Add articles
198
     *
199
     * @param \AppBundle\Entity\Article $articles
200
     * @return Material
201
     */
202
    public function addArticle(Article $articles)
203
    {
204
        $this->articles[] = $articles;
205
206
        return $this;
207
    }
208
209
    /**
210
     * Remove articles
211
     *
212
     * @param \AppBundle\Entity\Article $articles
213
     */
214
    public function removeArticle(Article $articles)
215
    {
216
        $this->articles->removeElement($articles);
217
    }
218
219
    /**
220
     * Get articles
221
     *
222
     * @return \Doctrine\Common\Collections\Collection
223
     */
224
    public function getArticles()
225
    {
226
        return $this->articles;
227
    }
228
229
    /**
230
     * Get slug
231
     *
232
     * @return string
233
     */
234
    public function getSlug()
235
    {
236
        return $this->slug;
237
    }
238
}
239