Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
9 / 9
CRAP
100.00% covered (success)
100.00%
1 / 1
TerminReaction
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
9 / 9
10
100.00% covered (success)
100.00%
1 / 1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 setId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTermin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setTermin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setUser
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEmoji
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEmoji
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 testOnlyGetField
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Olz\Entity\Termine;
4
5use Doctrine\ORM\Mapping as ORM;
6use Olz\Entity\Common\TestableInterface;
7use Olz\Entity\Users\User;
8use Olz\Repository\Termine\TerminReactionRepository;
9
10#[ORM\Table(name: 'termin_reactions')]
11#[ORM\Index(name: 'termin_emoji_user_index', columns: ['termin_id', 'emoji', 'user_id'])]
12#[ORM\Entity(repositoryClass: TerminReactionRepository::class)]
13class TerminReaction implements TestableInterface {
14    /** Emojis that count as a participation. */
15    public const ACCEPT_EMOJIS = ['👍', '✅', '✔️'];
16
17    /** Emojis that count as a declined. */
18    public const DECLINE_EMOJIS = ['👎', '❎', '❌', '😢', '🚫'];
19
20    #[ORM\Id]
21    #[ORM\Column(type: 'bigint', nullable: false)]
22    #[ORM\GeneratedValue]
23    private int|string $id;
24
25    #[ORM\ManyToOne(targetEntity: Termin::class)]
26    #[ORM\JoinColumn(name: 'termin_id', referencedColumnName: 'id', nullable: false)]
27    private Termin $termin;
28
29    #[ORM\ManyToOne(targetEntity: User::class)]
30    #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false)]
31    private User $user;
32
33    #[ORM\Column(type: 'string', length: 15, nullable: false, options: ['collation' => 'utf8mb4_bin'])]
34    private string $emoji;
35
36    public function getId(): ?int {
37        return isset($this->id) ? intval($this->id) : null;
38    }
39
40    public function setId(int $new_value): void {
41        $this->id = $new_value;
42    }
43
44    public function getTermin(): Termin {
45        return $this->termin;
46    }
47
48    public function setTermin(Termin $new_value): void {
49        $this->termin = $new_value;
50    }
51
52    public function getUser(): User {
53        return $this->user;
54    }
55
56    public function setUser(User $new_value): void {
57        $this->user = $new_value;
58    }
59
60    public function getEmoji(): string {
61        return $this->emoji;
62    }
63
64    public function setEmoji(string $new_value): void {
65        $this->emoji = $new_value;
66    }
67
68    // ---
69
70    public function testOnlyGetField(string $field_name): mixed {
71        return $this->{$field_name};
72    }
73}