Completed
Push — Recipes ( 630f49...c8afb0 )
by Laurent
12:15 queued 03:48
created

Material::getSlug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Entity Material.
5
 *
6
 * PHP Version 7
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
 * @see https://github.com/Dev-Int/glsr
15
 */
16
17
namespace  App\Entity\Settings\Diverse;
18
19
use Doctrine\ORM\Mapping as ORM;
20
use Symfony\Component\Validator\Constraints as Assert;
21
use Gedmo\Mapping\Annotation as Gedmo;
22
use Doctrine\Common\Collections\ArrayCollection;
23
use App\Entity\Settings\Article;
24
25
/**
26
 * Material entity.
27
 *
28
 * @ORM\Table(name="gs_material")
29
 * @ORM\Entity(repositoryClass="App\Repository\Settings\Diverse\MaterialRepository")
30
 */
31
class Material
32
{
33
    /**
34
     * @var int $mtId Id of the material
35
     *
36
     * @ORM\Column(name="id", type="integer")
37
     * @ORM\Id
38
     * @ORM\GeneratedValue(strategy="AUTO")
39
     */
40
    private $mtId;
41
42
    /**
43
     * @var string $name Name of the material
44
     *
45
     * @ORM\Column(name="name", length=128, type="string", unique=true)
46
     */
47
    private $name;
48
49
    /**
50
     * @var string|\App\Entity\Settings\Diverse\Unit $unitWorking Storage unit
51
     *
52
     * @ORM\ManyToOne(targetEntity="App\Entity\Settings\Diverse\Unit")
53
     */
54
    private $unitWorking;
55
56
    /**
57
     * @var bool $active
58
     *
59
     * @ORM\Column(name="active", type="boolean")
60
     */
61
    private $active;
62
63
    /**
64
     * @var bool $multiple
65
     *
66
     * @ORM\Column(name="multiple", type="boolean")
67
     */
68
    private $multiple;
69
70
    /**
71
     * @var \Doctrine\Common\Collections\ArrayCollection $articles Article(s)
72
     *
73
     * @ORM\ManyToMany(targetEntity="App\Entity\Settings\Article")
74
     * @ORM\JoinTable(name="gs_material_article")
75
     * @Assert\NotBlank()
76
     */
77
    private $articles;
78
79
    /**
80
     * @var string $slug
81
     * @Gedmo\Slug(fields={"name"}, updatable=false)
82
     * @ORM\Column(length=128, unique=true)
83
     */
84
    private $slug;
85
86
    /**
87
     * Constructor.
88
     */
89
    public function __construct()
90
    {
91
        $this->articles = new ArrayCollection();
92
    }
93
94
    /**
95
     * Get id.
96
     *
97
     * @return int
98
     */
99
    public function getId()
100
    {
101
        return $this->mtId;
102
    }
103
104
    /**
105
     * Set name.
106
     *
107
     * @param string $name
108
     *
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 bool $active
132
     *
133
     * @return Material
134
     */
135
    public function setActive($active)
136
    {
137
        $this->active = $active;
138
139
        return $this;
140
    }
141
142
    /**
143
     * Get active.
144
     *
145
     * @return bool
146
     */
147
    public function isActive()
148
    {
149
        return $this->active;
150
    }
151
152
    /**
153
     * Set multiple.
154
     *
155
     * @param bool $multiple
156
     *
157
     * @return Material
158
     */
159
    public function setMultiple($multiple)
160
    {
161
        $this->multiple = $multiple;
162
163
        return $this;
164
    }
165
166
    /**
167
     * Get multiple.
168
     *
169
     * @return bool
170
     */
171
    public function isMultiple()
172
    {
173
        return $this->multiple;
174
    }
175
176
    /**
177
     * Set unitStorage.
178
     *
179
     * @param \App\Entity\Settings\Diverse\Unit $unitWorking
180
     *
181
     * @return Material
182
     */
183
    public function setUnitWorking(Unit $unitWorking = null)
184
    {
185
        $this->unitWorking = $unitWorking;
186
187
        return $this;
188
    }
189
190
    /**
191
     * Get unitWorking.
192
     *
193
     * @return \App\Entity\Settings\Diverse\Units
194
     */
195
    public function getUnitWorking()
196
    {
197
        return $this->unitWorking;
198
    }
199
200
    /**
201
     * Add articles.
202
     *
203
     * @param \App\Entity\Settings\Article $articles
204
     *
205
     * @return Material
206
     */
207
    public function addArticle(Article $articles)
208
    {
209
        $this->articles[] = $articles;
210
211
        return $this;
212
    }
213
214
    /**
215
     * Remove articles.
216
     *
217
     * @param \App\Entity\Settings\Article $articles
218
     */
219
    public function removeArticle(Article $articles)
220
    {
221
        $this->articles->removeElement($articles);
222
    }
223
224
    /**
225
     * Get articles.
226
     *
227
     * @return \Doctrine\Common\Collections\Collection
228
     */
229
    public function getArticles()
230
    {
231
        return $this->articles;
232
    }
233
234
    /**
235
     * Get slug.
236
     *
237
     * @return string
238
     */
239
    public function getSlug()
240
    {
241
        return $this->slug;
242
    }
243
}
244