Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 1 |
QuestionCategory | |
0.00% |
0 / 10 |
|
0.00% |
0 / 10 |
110 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPosition | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setPosition | |
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 | |||
getIdFieldNameForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getIdForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCriteriaForQuery | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTitleForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Entity\Faq; |
4 | |
5 | use Doctrine\Common\Collections\Criteria; |
6 | use Doctrine\Common\Collections\Expr\Expression; |
7 | use Doctrine\ORM\Mapping as ORM; |
8 | use Olz\Entity\Common\OlzEntity; |
9 | use Olz\Entity\Common\SearchableInterface; |
10 | |
11 | #[ORM\Table(name: 'question_categories')] |
12 | #[ORM\Index(name: 'position_index', columns: ['on_off', 'position'])] |
13 | #[ORM\Entity] |
14 | class QuestionCategory extends OlzEntity implements SearchableInterface { |
15 | #[ORM\Id] |
16 | #[ORM\Column(type: 'integer', nullable: false)] |
17 | #[ORM\GeneratedValue] |
18 | private int $id; |
19 | |
20 | #[ORM\Column(type: 'integer', nullable: false)] |
21 | private int $position; |
22 | |
23 | #[ORM\Column(type: 'string', nullable: false)] |
24 | private string $name; |
25 | |
26 | public function getId(): ?int { |
27 | return $this->id ?? null; |
28 | } |
29 | |
30 | public function setId(int $new_value): void { |
31 | $this->id = $new_value; |
32 | } |
33 | |
34 | public function getPosition(): int { |
35 | return $this->position; |
36 | } |
37 | |
38 | public function setPosition(int $new_value): void { |
39 | $this->position = $new_value; |
40 | } |
41 | |
42 | public function getName(): string { |
43 | return $this->name; |
44 | } |
45 | |
46 | public function setName(string $new_value): void { |
47 | $this->name = $new_value; |
48 | } |
49 | |
50 | // --- |
51 | |
52 | public static function getIdFieldNameForSearch(): string { |
53 | return 'id'; |
54 | } |
55 | |
56 | public function getIdForSearch(): int { |
57 | return $this->getId() ?? 0; |
58 | } |
59 | |
60 | public static function getCriteriaForQuery(string $query): Expression { |
61 | return Criteria::expr()->contains('name', $query); |
62 | } |
63 | |
64 | public function getTitleForSearch(): string { |
65 | return $this->getName(); |
66 | } |
67 | } |