Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
Skill | |
0.00% |
0 / 8 |
|
0.00% |
0 / 8 |
90 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCategories | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
clearCategories | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Entity\Quiz; |
4 | |
5 | use Doctrine\Common\Collections\ArrayCollection; |
6 | use Doctrine\Common\Collections\Collection; |
7 | use Doctrine\ORM\Mapping as ORM; |
8 | use Olz\Entity\Common\OlzEntity; |
9 | use Olz\Repository\Quiz\SkillRepository; |
10 | |
11 | #[ORM\Table(name: 'quiz_skill')] |
12 | #[ORM\Index(name: 'name_index', columns: ['name'])] |
13 | #[ORM\Entity(repositoryClass: SkillRepository::class)] |
14 | class Skill extends OlzEntity { |
15 | #[ORM\Id] |
16 | #[ORM\Column(type: 'bigint', nullable: false)] |
17 | #[ORM\GeneratedValue] |
18 | private int|string $id; |
19 | |
20 | #[ORM\Column(type: 'string', nullable: false)] |
21 | private string $name; |
22 | |
23 | /** @var Collection<int|string, SkillCategory>&iterable<SkillCategory> */ |
24 | #[ORM\JoinTable(name: 'quiz_skills_categories')] |
25 | #[ORM\JoinColumn(name: 'skill_id', referencedColumnName: 'id')] |
26 | #[ORM\InverseJoinColumn(name: 'category_id', referencedColumnName: 'id')] |
27 | #[ORM\ManyToMany(targetEntity: SkillCategory::class, inversedBy: 'skills')] |
28 | private Collection $categories; |
29 | |
30 | public function __construct() { |
31 | $this->categories = new ArrayCollection(); |
32 | } |
33 | |
34 | public function getId(): ?int { |
35 | return isset($this->id) ? intval($this->id) : null; |
36 | } |
37 | |
38 | public function setId(int $new_id): void { |
39 | $this->id = $new_id; |
40 | } |
41 | |
42 | public function getName(): string { |
43 | return $this->name; |
44 | } |
45 | |
46 | public function setName(string $new_name): void { |
47 | $this->name = $new_name; |
48 | } |
49 | |
50 | /** @return Collection<int|string, SkillCategory>&iterable<SkillCategory> */ |
51 | public function getCategories(): Collection { |
52 | return $this->categories; |
53 | } |
54 | |
55 | public function addCategory(SkillCategory $new_category): void { |
56 | $this->categories->add($new_category); |
57 | } |
58 | |
59 | public function clearCategories(): void { |
60 | $this->categories->clear(); |
61 | } |
62 | } |