Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 12 |
CRAP | |
0.00% |
0 / 1 |
AccessToken | |
0.00% |
0 / 12 |
|
0.00% |
0 / 12 |
182 | |
0.00% |
0 / 1 |
getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
setId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPurpose | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setPurpose | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCreatedAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getExpiresAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setExpiresAt | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Olz\Entity; |
4 | |
5 | use Doctrine\ORM\Mapping as ORM; |
6 | use Olz\Entity\Users\User; |
7 | use Olz\Repository\AccessTokenRepository; |
8 | |
9 | #[ORM\Table(name: 'access_tokens')] |
10 | #[ORM\Index(name: 'token_index', columns: ['token'])] |
11 | #[ORM\Index(name: 'user_id_index', columns: ['user_id'])] |
12 | #[ORM\Entity(repositoryClass: AccessTokenRepository::class)] |
13 | class AccessToken { |
14 | #[ORM\ManyToOne(targetEntity: User::class)] |
15 | #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true)] |
16 | private ?User $user; |
17 | |
18 | #[ORM\Column(type: 'string', nullable: false)] |
19 | private string $purpose; |
20 | |
21 | #[ORM\Column(type: 'string', nullable: false)] |
22 | private string $token; |
23 | |
24 | #[ORM\Column(type: 'datetime', nullable: false)] |
25 | private \DateTime $created_at; |
26 | |
27 | #[ORM\Column(type: 'datetime', nullable: true)] |
28 | private ?\DateTime $expires_at; |
29 | |
30 | #[ORM\Id] |
31 | #[ORM\Column(type: 'bigint', nullable: false)] |
32 | #[ORM\GeneratedValue] |
33 | private int|string $id; |
34 | |
35 | public function getId(): ?int { |
36 | return isset($this->id) ? intval($this->id) : null; |
37 | } |
38 | |
39 | public function setId(int $new_id): void { |
40 | $this->id = $new_id; |
41 | } |
42 | |
43 | public function getUser(): ?User { |
44 | return $this->user; |
45 | } |
46 | |
47 | public function setUser(?User $new_user): void { |
48 | $this->user = $new_user; |
49 | } |
50 | |
51 | public function getPurpose(): string { |
52 | return $this->purpose; |
53 | } |
54 | |
55 | public function setPurpose(string $new_purpose): void { |
56 | $this->purpose = $new_purpose; |
57 | } |
58 | |
59 | public function getToken(): string { |
60 | return $this->token; |
61 | } |
62 | |
63 | public function setToken(string $new_token): void { |
64 | $this->token = $new_token; |
65 | } |
66 | |
67 | public function getCreatedAt(): \DateTime { |
68 | return $this->created_at; |
69 | } |
70 | |
71 | public function setCreatedAt(\DateTime $new_created_at): void { |
72 | $this->created_at = $new_created_at; |
73 | } |
74 | |
75 | public function getExpiresAt(): ?\DateTime { |
76 | return $this->expires_at; |
77 | } |
78 | |
79 | public function setExpiresAt(?\DateTime $new_expires_at): void { |
80 | $this->expires_at = $new_expires_at; |
81 | } |
82 | } |