Completed
Pull Request — master (#124)
by Serhii
11:55
created

Role::setEmployee()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use Gedmo\Blameable\Traits\BlameableEntity;
8
use Symfony\Component\Validator\Constraints as Assert;
9
use AppBundle\Traits\TimestampableTrait;
10
use AppBundle\Traits\DeletedByTrait;
11
use JMS\Serializer\Annotation\ExclusionPolicy;
12
use JMS\Serializer\Annotation\Expose;
13
use JMS\Serializer\Annotation\Type;
14
use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface;
15
use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable;
16
17
/**
18
 * @ORM\Table(name="roles")
19
 * @ORM\Entity
20
 * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
21
 * @Gedmo\TranslationEntity(class="AppBundle\Entity\Translations\RoleTranslation")
22
 * @ExclusionPolicy("all")
23
 */
24
class Role extends AbstractPersonalTranslatable implements TranslatableInterface
25
{
26
    use TimestampableTrait, BlameableEntity, DeletedByTrait;
27
28
    /**
29
     * @var integer
30
     *
31
     * @ORM\Column(name="id", type="integer")
32
     * @ORM\Id
33
     * @ORM\GeneratedValue(strategy="AUTO")
34
     */
35
    private $id;
36
37
    /**
38
     * @var string
39
     * @Gedmo\Translatable
40
     * @Assert\NotBlank()
41
     * @ORM\Column(type="string", length=255)
42
     * @Type("string")
43
     * @Expose
44
     */
45
    private $title;
46
47
    /**
48
     * @var string
49
     * @Gedmo\Translatable
50
     * @ORM\Column(type="text", nullable=true)
51
     * @Type("string")
52
     * @Expose
53
     */
54
    private $description;
55
56
    /**
57
     * @var Performance
58
     *
59
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Performance", inversedBy="roles")
60
     * @Expose()
61
     */
62
    private $performance;
63
64
    /**
65
     * @var Employee
66
     *
67
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Employee", inversedBy="roles")
68
     * @Type("AppBundle\Entity\Employee")
69
     * @Expose
70
     */
71
    private $employee;
72
73
    /**
74
     * @Gedmo\Slug(fields={"title"})
75
     * @ORM\Column(name="slug", type="string", length=255)
76
     * @Type("string")
77
     * @Expose
78
     */
79
    private $slug;
80
81
    /**
82
     * @var ArrayCollection
83
     *
84
     * @ORM\OneToMany(
85
     *     targetEntity="AppBundle\Entity\Translations\RoleTranslation",
86
     *     mappedBy="object",
87
     *     cascade={"persist", "remove"}
88
     * )
89
     */
90
    protected $translations;
91
92
    /**
93
     * Unset translations
94
     *
95
     * @return Role
96
     */
97 1
    public function unsetTranslations()
98
    {
99 1
        $this->translations = null;
100
101 1
        return $this;
102
    }
103
104
    /**
105
     * Get id
106
     *
107
     * @return integer
108
     */
109 1
    public function getId()
110
    {
111 1
        return $this->id;
112
    }
113
114
    /**
115
     * Get title
116
     *
117
     * @return string
118
     */
119 1
    public function getTitle()
120
    {
121 1
        return $this->title;
122
    }
123
124
    /**
125
     * Set title
126
     *
127
     * @param  string $title
128
     * @return Role
129
     */
130
    public function setTitle($title)
131
    {
132
        $this->title = $title;
133
134
        return $this;
135
    }
136
137
    /**
138
     * Get description
139
     *
140
     * @return string
141
     */
142
    public function getDescription()
143
    {
144
        return $this->description;
145
    }
146
147
    /**
148
     * Set description
149
     *
150
     * @param  string $description
151
     * @return Role
152
     */
153
    public function setDescription($description)
154
    {
155
        $this->description = $description;
156
157
        return $this;
158
    }
159
160
    /**
161
     * Get slug
162
     *
163
     * @return string
164
     */
165
    public function getSlug()
166
    {
167
        return $this->slug;
168
    }
169
170
    /**
171
     * Set slug
172
     *
173
     * @param  string $slug
174
     * @return Role
175
     */
176
    public function setSlug($slug)
177
    {
178
        $this->slug = $slug;
179
180
        return $this;
181
    }
182
183
    /**
184
     * Get performance
185
     *
186
     * @return \AppBundle\Entity\Performance
187
     */
188
    public function getPerformance()
189
    {
190
        return $this->performance;
191
    }
192
193
    /**
194
     * Set performance
195
     *
196
     * @param  \AppBundle\Entity\Performance $performance
197
     * @return Role
198
     */
199
    public function setPerformance(\AppBundle\Entity\Performance $performance = null)
200
    {
201
        $this->performance = $performance;
202
203
        return $this;
204
    }
205
206
    /**
207
     * Get employee
208
     *
209
     * @return \AppBundle\Entity\Employee
210
     */
211 1
    public function getEmployee()
212
    {
213 1
        return $this->employee;
214
    }
215
216
    /**
217
     * Set employee
218
     *
219
     * @param  \AppBundle\Entity\Employee $employee
220
     * @return Role
221
     */
222
    public function setEmployee(\AppBundle\Entity\Employee $employee = null)
223
    {
224
        $this->employee = $employee;
225
226
        return $this;
227
    }
228
229 1
    public function __toString()
230
    {
231 1
        return $this->getTitle();
232
    }
233
}
234