Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
SkillCategory | |
0.00% |
0 / 9 |
|
0.00% |
0 / 9 |
90 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getParentCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setParentCategory | |
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 | |||
getSkills | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addSkill | |
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\SkillCategoryRepository; |
10 | |
11 | #[ORM\Table(name: 'quiz_categories')] |
12 | #[ORM\Index(name: 'name_index', columns: ['name'])] |
13 | #[ORM\Index(name: 'parent_category_index', columns: ['parent_category_id'])] |
14 | #[ORM\Entity(repositoryClass: SkillCategoryRepository::class)] |
15 | class SkillCategory extends OlzEntity { |
16 | #[ORM\Id] |
17 | #[ORM\Column(type: 'integer', nullable: false)] |
18 | #[ORM\GeneratedValue] |
19 | private int $id; |
20 | |
21 | #[ORM\ManyToOne(targetEntity: SkillCategory::class)] |
22 | #[ORM\JoinColumn(name: 'parent_category_id', referencedColumnName: 'id', nullable: true)] |
23 | private ?SkillCategory $parent_category; |
24 | |
25 | #[ORM\Column(type: 'string', nullable: false)] |
26 | private string $name; |
27 | |
28 | /** @var Collection<int|string, Skill>&iterable<Skill> */ |
29 | #[ORM\ManyToMany(targetEntity: Skill::class, mappedBy: 'categories')] |
30 | private Collection $skills; |
31 | |
32 | public function __construct() { |
33 | $this->skills = new ArrayCollection(); |
34 | } |
35 | |
36 | public function getId(): ?int { |
37 | return $this->id ?? null; |
38 | } |
39 | |
40 | public function setId(int $new_id): void { |
41 | $this->id = $new_id; |
42 | } |
43 | |
44 | public function getParentCategory(): ?SkillCategory { |
45 | return $this->parent_category; |
46 | } |
47 | |
48 | public function setParentCategory(?SkillCategory $new_parent_category): void { |
49 | $this->parent_category = $new_parent_category; |
50 | } |
51 | |
52 | public function getName(): string { |
53 | return $this->name; |
54 | } |
55 | |
56 | public function setName(string $new_name): void { |
57 | $this->name = $new_name; |
58 | } |
59 | |
60 | /** @return Collection<int|string, Skill>&iterable<Skill> */ |
61 | public function getSkills(): Collection { |
62 | return $this->skills; |
63 | } |
64 | |
65 | public function addSkill(Skill $new_skill): void { |
66 | $this->skills->add($new_skill); |
67 | } |
68 | } |