|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Orm\Entity; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\Mapping\Column; |
|
8
|
|
|
use Doctrine\ORM\Mapping\Entity; |
|
9
|
|
|
use Doctrine\ORM\Mapping\Id; |
|
10
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
|
11
|
|
|
use Doctrine\ORM\Mapping\OneToOne; |
|
12
|
|
|
use Doctrine\ORM\Mapping\Table; |
|
13
|
|
|
|
|
14
|
|
|
#[Table(name: 'stu_pirate_wrath')] |
|
15
|
|
|
#[Entity(repositoryClass: 'Stu\Orm\Repository\PirateWrathRepository')] |
|
16
|
|
|
class PirateWrath implements PirateWrathInterface |
|
17
|
|
|
{ |
|
18
|
|
|
#[Id] |
|
19
|
|
|
#[Column(type: 'integer')] |
|
20
|
|
|
private int $user_id; |
|
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
#[Column(type: 'integer')] |
|
23
|
|
|
private int $wrath = 100; |
|
24
|
|
|
|
|
25
|
|
|
#[Column(type: 'integer', nullable: true)] |
|
26
|
|
|
private ?int $protection_timeout = null; |
|
27
|
|
|
|
|
28
|
|
|
#[OneToOne(targetEntity: 'User', inversedBy: 'pirateWrath')] |
|
29
|
|
|
#[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
|
30
|
|
|
private UserInterface $user; |
|
31
|
|
|
|
|
32
|
|
|
public function getUser(): UserInterface |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->user; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function setUser(UserInterface $user): PirateWrathInterface |
|
38
|
|
|
{ |
|
39
|
|
|
$this->user = $user; |
|
40
|
|
|
|
|
41
|
|
|
return $this; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function getWrath(): int |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->wrath; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function setWrath(int $wrath): PirateWrathInterface |
|
50
|
|
|
{ |
|
51
|
|
|
$this->wrath = $wrath; |
|
52
|
|
|
|
|
53
|
|
|
return $this; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function getProtectionTimeout(): ?int |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->protection_timeout; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setProtectionTimeout(?int $timestamp): PirateWrathInterface |
|
62
|
|
|
{ |
|
63
|
|
|
$this->protection_timeout = $timestamp; |
|
64
|
|
|
|
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|