Role::setEmployee()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\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 App\Traits\TimestampableTrait;
10
use App\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="App\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="App\Entity\Performance", inversedBy="roles")
60
     * @Expose()
61
     */
62
    private $performance;
63
64
    /**
65
     * @var Employee
66
     *
67
     * @ORM\ManyToOne(targetEntity="App\Entity\Employee", inversedBy="roles")
68
     * @Type("App\Entity\Employee")
69
     * @Assert\NotBlank()
70
     * @Expose
71
     */
72
    private $employee;
73
74
    /**
75
     * @Gedmo\Slug(fields={"title"})
76
     * @ORM\Column(name="slug", type="string", length=255)
77
     * @Type("string")
78
     * @Expose
79
     */
80
    private $slug;
81
82
    /**
83
     * @var ArrayCollection
84
     *
85
     * @ORM\OneToMany(
86
     *     targetEntity="App\Entity\Translations\RoleTranslation",
87
     *     mappedBy="object",
88
     *     cascade={"persist", "remove"}
89
     * )
90
     */
91
    protected $translations;
92
93
    /**
94
     * Unset translations
95
     *
96
     * @return Role
97
     */
98 1
    public function unsetTranslations()
99
    {
100 1
        $this->translations = null;
101
102 1
        return $this;
103
    }
104
105
    /**
106
     * Get id
107
     *
108
     * @return integer
109
     */
110 2
    public function getId()
111
    {
112 2
        return $this->id;
113
    }
114
115
    /**
116
     * Get title
117
     *
118
     * @return string
119
     */
120 5
    public function getTitle()
121
    {
122 5
        return $this->title;
123
    }
124
125
    /**
126
     * Set title
127
     *
128
     * @param  string $title
129
     * @return Role
130
     */
131
    public function setTitle($title)
132
    {
133
        $this->title = $title;
134
135
        return $this;
136
    }
137
138
    /**
139
     * Get description
140
     *
141
     * @return string
142
     */
143 3
    public function getDescription()
144
    {
145 3
        return $this->description;
146
    }
147
148
    /**
149
     * Set description
150
     *
151
     * @param  string $description
152
     * @return Role
153
     */
154
    public function setDescription($description)
155
    {
156
        $this->description = $description;
157
158
        return $this;
159
    }
160
161
    /**
162
     * Get slug
163
     *
164
     * @return string
165
     */
166
    public function getSlug()
167
    {
168
        return $this->slug;
169
    }
170
171
    /**
172
     * Set slug
173
     *
174
     * @param  string $slug
175
     * @return Role
176
     */
177
    public function setSlug($slug)
178
    {
179
        $this->slug = $slug;
180
181
        return $this;
182
    }
183
184
    /**
185
     * Get performance
186
     *
187
     * @return \App\Entity\Performance
188
     */
189 2
    public function getPerformance()
190
    {
191 2
        return $this->performance;
192
    }
193
194
    /**
195
     * Set performance
196
     *
197
     * @param  \App\Entity\Performance $performance
198
     * @return Role
199
     */
200
    public function setPerformance(\App\Entity\Performance $performance = null)
201
    {
202
        $this->performance = $performance;
203
204
        return $this;
205
    }
206
207
    /**
208
     * Get employee
209
     *
210
     * @return \App\Entity\Employee
211
     */
212 4
    public function getEmployee()
213
    {
214 4
        return $this->employee;
215
    }
216
217
    /**
218
     * Set employee
219
     *
220
     * @param  \App\Entity\Employee $employee
221
     * @return Role
222
     */
223
    public function setEmployee(\App\Entity\Employee $employee = null)
224
    {
225
        $this->employee = $employee;
226
227
        return $this;
228
    }
229
230 3
    public function __toString()
231
    {
232 3
        return $this->getTitle();
233
    }
234
}
235