1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\GameBetting\Persistence\Entity; |
4
|
|
|
|
5
|
|
|
use App\GameCore\Persistence\Entity\Game; |
6
|
|
|
use App\User\Persistence\Entity\User; |
7
|
|
|
use Doctrine\ORM\Mapping as ORM; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @ORM\Entity(repositoryClass="App\GameBetting\Persistence\Repository\UserBettingRepository") |
11
|
|
|
* @ORM\HasLifecycleCallbacks |
12
|
|
|
*/ |
13
|
|
|
class UserBetting |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @ORM\Id() |
17
|
|
|
* @ORM\GeneratedValue() |
18
|
|
|
* @ORM\Column(type="integer") |
19
|
|
|
*/ |
20
|
|
|
private $id; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @ORM\ManyToOne(targetEntity="App\GameCore\Persistence\Entity\Game", inversedBy="installations") |
24
|
|
|
* @ORM\JoinColumn(name="game_id", referencedColumnName="id") |
25
|
|
|
*/ |
26
|
|
|
private $game; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\ManyToOne(targetEntity="App\User\Persistence\Entity\User", inversedBy="installations") |
30
|
|
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="id") |
31
|
|
|
*/ |
32
|
|
|
private $user; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @ORM\Column(type="datetime") |
36
|
|
|
*/ |
37
|
|
|
private $date; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @ORM\Column(type="integer", nullable=true) |
41
|
|
|
*/ |
42
|
|
|
private $firstTeamResult; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @ORM\Column(type="integer", nullable=true) |
46
|
|
|
*/ |
47
|
|
|
private $secondTeamResult; |
48
|
|
|
|
49
|
|
|
public function getId() |
50
|
|
|
{ |
51
|
|
|
return $this->id; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getGame(): ?Game |
55
|
|
|
{ |
56
|
|
|
return $this->game; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function setGame(Game $game): self |
60
|
|
|
{ |
61
|
|
|
$this->game = $game; |
62
|
|
|
|
63
|
|
|
return $this; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function getUser(): ?User |
67
|
|
|
{ |
68
|
|
|
return $this->user; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function setUser(User $user): self |
72
|
|
|
{ |
73
|
|
|
$this->user = $user; |
74
|
|
|
|
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getDate(): ?\DateTimeInterface |
79
|
|
|
{ |
80
|
|
|
return $this->date; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function setDate(\DateTimeInterface $date): self |
84
|
|
|
{ |
85
|
|
|
$this->date = $date; |
86
|
|
|
|
87
|
|
|
return $this; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function getFirstTeamResult(): ?int |
91
|
|
|
{ |
92
|
|
|
return $this->firstTeamResult; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function setFirstTeamResult(int $firstTeamResult): self |
96
|
|
|
{ |
97
|
|
|
$this->firstTeamResult = $firstTeamResult; |
98
|
|
|
|
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function getSecondTeamResult(): ?int |
103
|
|
|
{ |
104
|
|
|
return $this->secondTeamResult; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function setSecondTeamResult(int $secondTeamResult): self |
108
|
|
|
{ |
109
|
|
|
$this->secondTeamResult = $secondTeamResult; |
110
|
|
|
|
111
|
|
|
return $this; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Gets triggered only on insert |
116
|
|
|
|
117
|
|
|
* @ORM\PrePersist |
118
|
|
|
*/ |
119
|
|
|
public function onPrePersist() |
120
|
|
|
{ |
121
|
|
|
$this->date = new \DateTime("now"); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Gets triggered every time on update |
126
|
|
|
|
127
|
|
|
* @ORM\PreUpdate |
128
|
|
|
*/ |
129
|
|
|
public function onPreUpdate() |
130
|
|
|
{ |
131
|
|
|
$this->date = new \DateTime("now"); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
|