Completed
Push — Recipes ( 931021...804a32 )
by Laurent
03:33
created

Material::getUnitStorage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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