Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 42 |
|
0.00% |
0 / 36 |
CRAP | |
0.00% |
0 / 1 |
NewsEntry | |
0.00% |
0 / 42 |
|
0.00% |
0 / 36 |
1722 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPublishedDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setPublishedDate | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPublishedTime | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setPublishedTime | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFormat | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setFormat | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAuthorName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAuthorName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAuthorEmail | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAuthorEmail | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAuthorUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAuthorUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getAuthorRole | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setAuthorRole | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTeaser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTeaser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getImageIds | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
setImageIds | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
getTags | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTags | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getExternalUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setExternalUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTermin | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTermin | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCounter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCounter | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getNewsletter | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
setNewsletter | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
__toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
testOnlyGetField | |
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\News; |
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\Entity\Common\TestableInterface; |
10 | use Olz\Entity\Roles\Role; |
11 | use Olz\Entity\Users\User; |
12 | use Olz\Repository\News\NewsRepository; |
13 | |
14 | #[ORM\Table(name: 'news')] |
15 | #[ORM\Index(name: 'published_index', columns: ['published_date', 'published_time'])] |
16 | #[ORM\Entity(repositoryClass: NewsRepository::class)] |
17 | class NewsEntry extends OlzEntity implements DataStorageInterface, TestableInterface { |
18 | use DataStorageTrait; |
19 | |
20 | #[ORM\Id] |
21 | #[ORM\Column(type: 'integer', nullable: false)] |
22 | #[ORM\GeneratedValue] |
23 | private int $id; |
24 | |
25 | #[ORM\Column(type: 'integer', nullable: false)] |
26 | private int $termin; |
27 | |
28 | #[ORM\Column(type: 'date', nullable: false)] |
29 | private \DateTime $published_date; |
30 | |
31 | #[ORM\Column(type: 'time', nullable: true)] |
32 | private ?\DateTime $published_time; |
33 | |
34 | #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => 1])] |
35 | private bool $newsletter; |
36 | |
37 | #[ORM\Column(type: 'text', nullable: false)] |
38 | private string $title; |
39 | |
40 | #[ORM\Column(type: 'text', nullable: true)] |
41 | private ?string $teaser; |
42 | |
43 | #[ORM\Column(type: 'text', nullable: true)] |
44 | private ?string $content; |
45 | |
46 | #[ORM\Column(type: 'text', nullable: true)] |
47 | private ?string $image_ids; |
48 | |
49 | #[ORM\Column(type: 'text', nullable: true)] |
50 | private ?string $external_url; |
51 | |
52 | #[ORM\Column(type: 'string', nullable: true)] |
53 | private ?string $author_name; |
54 | |
55 | #[ORM\Column(type: 'string', nullable: true)] |
56 | private ?string $author_email; |
57 | |
58 | #[ORM\ManyToOne(targetEntity: User::class)] |
59 | #[ORM\JoinColumn(name: 'author_user_id', referencedColumnName: 'id', nullable: true)] |
60 | private ?User $author_user; |
61 | |
62 | #[ORM\ManyToOne(targetEntity: Role::class)] |
63 | #[ORM\JoinColumn(name: 'author_role_id', referencedColumnName: 'id', nullable: true)] |
64 | private ?Role $author_role; |
65 | |
66 | #[ORM\Column(type: 'text', nullable: false)] |
67 | private string $format; |
68 | |
69 | #[ORM\Column(type: 'text', nullable: false, options: ['default' => ''])] |
70 | private string $tags; |
71 | |
72 | #[ORM\Column(type: 'integer', nullable: false, options: ['default' => 0])] |
73 | private int $counter; |
74 | // PRIMARY KEY (`id`), |
75 | // KEY `datum` (`datum`) |
76 | |
77 | public function getId(): ?int { |
78 | return $this->id ?? null; |
79 | } |
80 | |
81 | public function setId(int $new_value): void { |
82 | $this->id = $new_value; |
83 | } |
84 | |
85 | public function getPublishedDate(): \DateTime { |
86 | return $this->published_date; |
87 | } |
88 | |
89 | public function setPublishedDate(\DateTime $new_value): void { |
90 | $this->published_date = $new_value; |
91 | } |
92 | |
93 | public function getPublishedTime(): ?\DateTime { |
94 | return $this->published_time; |
95 | } |
96 | |
97 | public function setPublishedTime(?\DateTime $new_value): void { |
98 | $this->published_time = $new_value; |
99 | } |
100 | |
101 | public function getFormat(): string { |
102 | return $this->format; |
103 | } |
104 | |
105 | public function setFormat(string $new_value): void { |
106 | $this->format = $new_value; |
107 | } |
108 | |
109 | public function getAuthorName(): ?string { |
110 | return $this->author_name; |
111 | } |
112 | |
113 | public function setAuthorName(?string $new_value): void { |
114 | $this->author_name = $new_value; |
115 | } |
116 | |
117 | public function getAuthorEmail(): ?string { |
118 | return $this->author_email; |
119 | } |
120 | |
121 | public function setAuthorEmail(?string $new_value): void { |
122 | $this->author_email = $new_value; |
123 | } |
124 | |
125 | public function getAuthorUser(): ?User { |
126 | return $this->author_user; |
127 | } |
128 | |
129 | public function setAuthorUser(?User $new_value): void { |
130 | $this->author_user = $new_value; |
131 | } |
132 | |
133 | public function getAuthorRole(): ?Role { |
134 | return $this->author_role; |
135 | } |
136 | |
137 | public function setAuthorRole(?Role $new_value): void { |
138 | $this->author_role = $new_value; |
139 | } |
140 | |
141 | public function getTitle(): string { |
142 | return $this->title; |
143 | } |
144 | |
145 | public function setTitle(string $new_value): void { |
146 | $this->title = $new_value; |
147 | } |
148 | |
149 | public function getTeaser(): ?string { |
150 | return $this->teaser; |
151 | } |
152 | |
153 | public function setTeaser(?string $new_value): void { |
154 | $this->teaser = $new_value; |
155 | } |
156 | |
157 | public function getContent(): ?string { |
158 | return $this->content; |
159 | } |
160 | |
161 | public function setContent(?string $new_value): void { |
162 | $this->content = $new_value; |
163 | } |
164 | |
165 | /** @return array<string> */ |
166 | public function getImageIds(): array { |
167 | if ($this->image_ids == null) { |
168 | return []; |
169 | } |
170 | $array = json_decode($this->image_ids, true); |
171 | return is_array($array) ? $array : []; |
172 | } |
173 | |
174 | /** @param array<string> $new_value */ |
175 | public function setImageIds(array $new_value): void { |
176 | $enc_value = json_encode($new_value); |
177 | if (!$enc_value) { |
178 | return; |
179 | } |
180 | $this->image_ids = $enc_value; |
181 | } |
182 | |
183 | public function getTags(): string { |
184 | return $this->tags; |
185 | } |
186 | |
187 | public function setTags(string $new_value): void { |
188 | $this->tags = $new_value; |
189 | } |
190 | |
191 | public function getExternalUrl(): ?string { |
192 | return $this->external_url; |
193 | } |
194 | |
195 | public function setExternalUrl(?string $new_value): void { |
196 | $this->external_url = $new_value; |
197 | } |
198 | |
199 | public function getTermin(): int { |
200 | return $this->termin; |
201 | } |
202 | |
203 | public function setTermin(int $new_value): void { |
204 | $this->termin = $new_value; |
205 | } |
206 | |
207 | public function getCounter(): int { |
208 | return $this->counter; |
209 | } |
210 | |
211 | public function setCounter(int $new_value): void { |
212 | $this->counter = $new_value; |
213 | } |
214 | |
215 | /** @deprecated */ |
216 | public function getNewsletter(): bool { |
217 | return $this->newsletter; |
218 | } |
219 | |
220 | /** @deprecated */ |
221 | public function setNewsletter(bool $new_value): void { |
222 | $this->newsletter = $new_value; |
223 | } |
224 | |
225 | // --- |
226 | |
227 | public function __toString(): string { |
228 | return "NewsEntry (ID: {$this->getId()})"; |
229 | } |
230 | |
231 | public function testOnlyGetField(string $field_name): mixed { |
232 | return $this->{$field_name}; |
233 | } |
234 | |
235 | public static function getEntityNameForStorage(): string { |
236 | return 'news'; |
237 | } |
238 | |
239 | public function getEntityIdForStorage(): string { |
240 | return "{$this->getId()}"; |
241 | } |
242 | } |