Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 19 |
CRAP | |
0.00% |
0 / 1 |
TerminLabel | |
0.00% |
0 / 22 |
|
0.00% |
0 / 19 |
380 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
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 | |||
getIdent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setIdent | |
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 | |||
getDetails | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setDetails | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getIcon | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setIcon | |
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 | |||
getIdFieldNameForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getIdForSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCriteriaForQuery | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getTitleForSearch | |
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\Termine; |
4 | |
5 | use Doctrine\Common\Collections\ArrayCollection; |
6 | use Doctrine\Common\Collections\Collection; |
7 | use Doctrine\Common\Collections\Criteria; |
8 | use Doctrine\Common\Collections\Expr\Expression; |
9 | use Doctrine\ORM\Mapping as ORM; |
10 | use Olz\Entity\Common\DataStorageInterface; |
11 | use Olz\Entity\Common\DataStorageTrait; |
12 | use Olz\Entity\Common\OlzEntity; |
13 | use Olz\Entity\Common\SearchableInterface; |
14 | use Olz\Repository\Termine\TerminLabelRepository; |
15 | |
16 | #[ORM\Table(name: 'termin_labels')] |
17 | #[ORM\Index(name: 'ident_index', columns: ['on_off', 'ident'])] |
18 | #[ORM\Index(name: 'name_index', columns: ['name'])] |
19 | #[ORM\Index(name: 'position_index', columns: ['on_off', 'position'])] |
20 | #[ORM\Entity(repositoryClass: TerminLabelRepository::class)] |
21 | class TerminLabel extends OlzEntity implements SearchableInterface, DataStorageInterface { |
22 | use DataStorageTrait; |
23 | |
24 | #[ORM\Id] |
25 | #[ORM\Column(type: 'integer', nullable: false)] |
26 | #[ORM\GeneratedValue] |
27 | private int $id; |
28 | |
29 | #[ORM\Column(type: 'string', length: 31, nullable: false)] |
30 | private string $ident; |
31 | |
32 | #[ORM\Column(type: 'string', length: 127, nullable: false)] |
33 | private string $name; |
34 | |
35 | #[ORM\Column(type: 'text', nullable: true)] |
36 | private ?string $details; |
37 | |
38 | #[ORM\Column(type: 'text', nullable: true)] |
39 | private ?string $icon; |
40 | |
41 | #[ORM\Column(type: 'integer', nullable: false)] |
42 | private int $position; |
43 | |
44 | /** @var Collection<int|string, Termin>&iterable<Termin> */ |
45 | #[ORM\ManyToMany(targetEntity: Termin::class, mappedBy: 'labels')] |
46 | private Collection $termine; |
47 | |
48 | /** @var Collection<int|string, TerminTemplate>&iterable<TerminTemplate> */ |
49 | #[ORM\ManyToMany(targetEntity: TerminTemplate::class, mappedBy: 'labels')] |
50 | private Collection $termin_templates; |
51 | |
52 | public function __construct() { |
53 | $this->termine = new ArrayCollection(); |
54 | $this->termin_templates = new ArrayCollection(); |
55 | } |
56 | |
57 | public function getId(): ?int { |
58 | return $this->id ?? null; |
59 | } |
60 | |
61 | public function setId(int $new_value): void { |
62 | $this->id = $new_value; |
63 | } |
64 | |
65 | public function getIdent(): string { |
66 | return $this->ident; |
67 | } |
68 | |
69 | public function setIdent(string $new_value): void { |
70 | $this->ident = $new_value; |
71 | } |
72 | |
73 | public function getName(): string { |
74 | return $this->name; |
75 | } |
76 | |
77 | public function setName(string $new_value): void { |
78 | $this->name = $new_value; |
79 | } |
80 | |
81 | public function getDetails(): ?string { |
82 | return $this->details; |
83 | } |
84 | |
85 | public function setDetails(?string $new_value): void { |
86 | $this->details = $new_value; |
87 | } |
88 | |
89 | public function getIcon(): ?string { |
90 | return $this->icon; |
91 | } |
92 | |
93 | public function setIcon(?string $new_value): void { |
94 | $this->icon = $new_value; |
95 | } |
96 | |
97 | public function getPosition(): int { |
98 | return $this->position; |
99 | } |
100 | |
101 | public function setPosition(int $new_value): void { |
102 | $this->position = $new_value; |
103 | } |
104 | |
105 | // --- |
106 | |
107 | public static function getIdFieldNameForSearch(): string { |
108 | return 'id'; |
109 | } |
110 | |
111 | public function getIdForSearch(): int { |
112 | return $this->getId() ?? 0; |
113 | } |
114 | |
115 | public static function getCriteriaForQuery(string $query): Expression { |
116 | return Criteria::expr()->orX( |
117 | Criteria::expr()->contains('name', $query), |
118 | ); |
119 | } |
120 | |
121 | public function getTitleForSearch(): string { |
122 | return $this->getName(); |
123 | } |
124 | |
125 | public static function getEntityNameForStorage(): string { |
126 | return 'termin_labels'; |
127 | } |
128 | |
129 | public function getEntityIdForStorage(): string { |
130 | return "{$this->getId()}"; |
131 | } |
132 | } |