|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Uxmp\Core\Orm\Model; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\DBAL\Types\Types; |
|
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
9
|
|
|
use Uxmp\Core\Orm\Repository\SessionRepository; |
|
10
|
|
|
|
|
11
|
|
|
#[ORM\Entity(repositoryClass: SessionRepository::class)] |
|
12
|
|
|
#[ORM\Table(name: 'session')] |
|
13
|
|
|
class Session implements SessionInterface |
|
14
|
|
|
{ |
|
15
|
|
|
#[ORM\Column(type: Types::INTEGER)] |
|
16
|
|
|
#[ORM\Id, ORM\GeneratedValue(strategy: 'AUTO')] |
|
17
|
|
|
private int $id; |
|
18
|
|
|
|
|
19
|
|
|
#[ORM\Column(type: Types::STRING)] |
|
20
|
|
|
private string $subject = ''; |
|
21
|
|
|
|
|
22
|
|
|
#[ORM\Column(type: Types::BOOLEAN)] |
|
23
|
|
|
private bool $active = false; |
|
24
|
|
|
|
|
25
|
|
|
#[ORM\Column(type: Types::INTEGER)] |
|
26
|
|
|
private int $user_id = 0; |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
#[ORM\ManyToOne(targetEntity: UserInterface::class)] |
|
29
|
|
|
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
30
|
|
|
private UserInterface $user; |
|
31
|
|
|
|
|
32
|
|
|
public function getId(): int |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->id; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
1 |
|
public function getSubject(): string |
|
38
|
|
|
{ |
|
39
|
1 |
|
return $this->subject; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
1 |
|
public function setSubject(string $subject): SessionInterface |
|
43
|
|
|
{ |
|
44
|
1 |
|
$this->subject = $subject; |
|
45
|
1 |
|
return $this; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
1 |
|
public function getActive(): bool |
|
49
|
|
|
{ |
|
50
|
1 |
|
return $this->active; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
1 |
|
public function setActive(bool $active): SessionInterface |
|
54
|
|
|
{ |
|
55
|
1 |
|
$this->active = $active; |
|
56
|
1 |
|
return $this; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
1 |
|
public function getUser(): UserInterface |
|
60
|
|
|
{ |
|
61
|
1 |
|
return $this->user; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
1 |
|
public function setUser(UserInterface $user): SessionInterface |
|
65
|
|
|
{ |
|
66
|
1 |
|
$this->user = $user; |
|
67
|
1 |
|
return $this; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|