Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 14 |
CRAP | |
0.00% |
0 / 1 |
Question | |
0.00% |
0 / 14 |
|
0.00% |
0 / 14 |
210 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getIdent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setIdent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getQuestion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setQuestion | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPositionWithinCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setPositionWithinCategory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAnswer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAnswer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEntityNameForStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEntityIdForStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Entity\Faq; |
4 | |
5 | use Doctrine\ORM\Mapping as ORM; |
6 | use Olz\Entity\Common\DataStorageInterface; |
7 | use Olz\Entity\Common\DataStorageTrait; |
8 | use Olz\Entity\Common\OlzEntity; |
9 | use Olz\Repository\Faq\QuestionRepository; |
10 | |
11 | #[ORM\Table(name: 'questions')] |
12 | #[ORM\Index(name: 'ident_index', columns: ['on_off', 'ident'])] |
13 | #[ORM\Index(name: 'category_position_index', columns: ['on_off', 'category_id', 'position_within_category'])] |
14 | #[ORM\Entity(repositoryClass: QuestionRepository::class)] |
15 | class Question extends OlzEntity implements DataStorageInterface { |
16 | use DataStorageTrait; |
17 | |
18 | #[ORM\Id] |
19 | #[ORM\Column(type: 'integer', nullable: false)] |
20 | #[ORM\GeneratedValue] |
21 | private int $id; |
22 | |
23 | #[ORM\Column(type: 'string', length: 31, nullable: false)] |
24 | private string $ident; |
25 | |
26 | #[ORM\ManyToOne(targetEntity: QuestionCategory::class)] |
27 | #[ORM\JoinColumn(name: 'category_id', referencedColumnName: 'id', nullable: true)] |
28 | private ?QuestionCategory $category; |
29 | |
30 | #[ORM\Column(type: 'integer', nullable: false)] |
31 | private int $position_within_category; |
32 | |
33 | #[ORM\Column(type: 'text', nullable: false)] |
34 | private string $question; |
35 | |
36 | #[ORM\Column(type: 'text', nullable: true)] |
37 | private ?string $answer; |
38 | |
39 | public function getId(): ?int { |
40 | return $this->id ?? null; |
41 | } |
42 | |
43 | public function setId(int $new_value): void { |
44 | $this->id = $new_value; |
45 | } |
46 | |
47 | public function getIdent(): string { |
48 | return $this->ident; |
49 | } |
50 | |
51 | public function setIdent(string $new_value): void { |
52 | $this->ident = $new_value; |
53 | } |
54 | |
55 | public function getQuestion(): string { |
56 | return $this->question; |
57 | } |
58 | |
59 | public function setQuestion(string $new_value): void { |
60 | $this->question = $new_value; |
61 | } |
62 | |
63 | public function getCategory(): ?QuestionCategory { |
64 | return $this->category; |
65 | } |
66 | |
67 | public function setCategory(?QuestionCategory $new_value): void { |
68 | $this->category = $new_value; |
69 | } |
70 | |
71 | public function getPositionWithinCategory(): int { |
72 | return $this->position_within_category; |
73 | } |
74 | |
75 | public function setPositionWithinCategory(int $new_value): void { |
76 | $this->position_within_category = $new_value; |
77 | } |
78 | |
79 | public function getAnswer(): ?string { |
80 | return $this->answer; |
81 | } |
82 | |
83 | public function setAnswer(?string $new_value): void { |
84 | $this->answer = $new_value; |
85 | } |
86 | |
87 | // --- |
88 | |
89 | public static function getEntityNameForStorage(): string { |
90 | return 'questions'; |
91 | } |
92 | |
93 | public function getEntityIdForStorage(): string { |
94 | return "{$this->getId()}"; |
95 | } |
96 | } |