Issues (97)

src/Entity/KioskUser.php (1 issue)

1
<?php
2
3
namespace App\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Ramsey\Uuid\Uuid;
7
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
#[ORM\Entity]
11
#[UniqueEntity(fields: ['token'])]
12
class KioskUser {
13
14
    use IdTrait;
15
16
    use UuidTrait;
17
18
    #[ORM\ManyToOne(targetEntity: User::class)]
19
    #[ORM\JoinColumn(onDelete: 'CASCADE')]
20
    #[Assert\NotNull]
21
    private ?User $user = null;
22
23
    #[ORM\Column(type: 'string', unique: true)]
24
    private ?string $token = null;
25
26
    #[ORM\Column(type: 'text')]
27
    private ?string $ipAddresses = null;
28
29
    public function __construct() {
30
        $this->uuid = Uuid::uuid4();
31
    }
32
33
    public function getUser(): ?User {
34
        return $this->user;
35
    }
36
37
    public function setUser(?User $user): KioskUser {
38
        $this->user = $user;
39
        return $this;
40 3
    }
41 3
42 3
    public function getToken(): string {
43
        return $this->token;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->token could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
44
    }
45
46
    public function setToken(string $token): KioskUser {
47 1
        $this->token = $token;
48 1
        return $this;
49
    }
50
51
    public function getIpAddresses(): ?string {
52
        return $this->ipAddresses;
53
    }
54
55 3
    public function setIpAddresses(?string $ipAddresses): KioskUser {
56 3
        $this->ipAddresses = $ipAddresses;
57 3
        return $this;
58
    }
59
}