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