|
1
|
|
|
<?php
|
|
2
|
|
|
|
|
3
|
|
|
namespace OSS\CoreBundle\Entity;
|
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
6
|
|
|
|
|
7
|
|
|
/**
|
|
8
|
|
|
* @ORM\Entity
|
|
9
|
|
|
*/
|
|
10
|
|
|
class Transfer
|
|
11
|
|
|
{
|
|
12
|
|
|
/**
|
|
13
|
|
|
* @var int
|
|
14
|
|
|
*
|
|
15
|
|
|
* @ORM\Id
|
|
16
|
|
|
* @ORM\GeneratedValue
|
|
17
|
|
|
* @ORM\Column(type="integer")
|
|
18
|
|
|
*/
|
|
19
|
|
|
private $id;
|
|
20
|
|
|
|
|
21
|
|
|
/**
|
|
22
|
|
|
* @var Player
|
|
23
|
|
|
*
|
|
24
|
|
|
* @ORM\ManyToOne(targetEntity="Player", inversedBy="transfers", fetch="EAGER")
|
|
25
|
|
|
*/
|
|
26
|
|
|
private $player;
|
|
27
|
|
|
|
|
28
|
|
|
/**
|
|
29
|
|
|
* @var Team
|
|
30
|
|
|
*
|
|
31
|
|
|
* @ORM\ManyToOne(targetEntity="Team", inversedBy="transfersOutgoing", fetch="EAGER")
|
|
32
|
|
|
*/
|
|
33
|
|
|
private $originTeam;
|
|
34
|
|
|
|
|
35
|
|
|
/**
|
|
36
|
|
|
* @var Team
|
|
37
|
|
|
*
|
|
38
|
|
|
* @ORM\ManyToOne(targetEntity="Team", inversedBy="transfersIncoming", fetch="EAGER")
|
|
39
|
|
|
*/
|
|
40
|
|
|
private $targetTeam;
|
|
41
|
|
|
|
|
42
|
|
|
/**
|
|
43
|
|
|
* @var int
|
|
44
|
|
|
*
|
|
45
|
|
|
* @ORM\Column(type="integer")
|
|
46
|
|
|
*/
|
|
47
|
|
|
private $amount;
|
|
48
|
|
|
|
|
49
|
|
|
/**
|
|
50
|
|
|
* @var int
|
|
51
|
|
|
*
|
|
52
|
|
|
* @ORM\Column(type="integer")
|
|
53
|
|
|
*/
|
|
54
|
|
|
private $season;
|
|
55
|
|
|
|
|
56
|
|
|
/**
|
|
57
|
|
|
* @param TransferOffer $transferOffer
|
|
58
|
|
|
* @param GameDate $gameDate
|
|
59
|
|
|
*
|
|
60
|
|
|
* @return Transfer
|
|
61
|
|
|
*/
|
|
62
|
|
|
static public function createFromOffer(TransferOffer $transferOffer, GameDate $gameDate)
|
|
63
|
|
|
{
|
|
64
|
|
|
$transfer = new Transfer();
|
|
65
|
|
|
$transfer->setOriginTeam($transferOffer->getOriginTeam());
|
|
66
|
|
|
$transfer->setTargetTeam($transferOffer->getTargetTeam());
|
|
67
|
|
|
$transfer->setPlayer($transferOffer->getPlayer());
|
|
68
|
|
|
$transfer->setAmount($transferOffer->getAmount());
|
|
69
|
|
|
$transfer->setSeason($gameDate->getSeason());
|
|
70
|
|
|
|
|
71
|
|
|
return $transfer;
|
|
72
|
|
|
}
|
|
73
|
|
|
|
|
74
|
|
|
/**
|
|
75
|
|
|
* @return Player
|
|
76
|
|
|
*/
|
|
77
|
|
|
public function getPlayer()
|
|
78
|
|
|
{
|
|
79
|
|
|
return $this->player;
|
|
80
|
|
|
}
|
|
81
|
|
|
|
|
82
|
|
|
/**
|
|
83
|
|
|
* @param Player $player
|
|
84
|
|
|
*/
|
|
85
|
|
|
public function setPlayer(Player $player)
|
|
86
|
|
|
{
|
|
87
|
|
|
$this->player = $player;
|
|
88
|
|
|
}
|
|
89
|
|
|
|
|
90
|
|
|
/**
|
|
91
|
|
|
* @return Team
|
|
92
|
|
|
*/
|
|
93
|
|
|
public function getOriginTeam()
|
|
94
|
|
|
{
|
|
95
|
|
|
return $this->originTeam;
|
|
96
|
|
|
}
|
|
97
|
|
|
|
|
98
|
|
|
/**
|
|
99
|
|
|
* @param Team $originTeam
|
|
100
|
|
|
*/
|
|
101
|
|
|
public function setOriginTeam(Team $originTeam)
|
|
102
|
|
|
{
|
|
103
|
|
|
$this->originTeam = $originTeam;
|
|
104
|
|
|
}
|
|
105
|
|
|
|
|
106
|
|
|
/**
|
|
107
|
|
|
* @return Team
|
|
108
|
|
|
*/
|
|
109
|
|
|
public function getTargetTeam()
|
|
110
|
|
|
{
|
|
111
|
|
|
return $this->targetTeam;
|
|
112
|
|
|
}
|
|
113
|
|
|
|
|
114
|
|
|
/**
|
|
115
|
|
|
* @param Team $targetTeam
|
|
116
|
|
|
*/
|
|
117
|
|
|
public function setTargetTeam(Team $targetTeam)
|
|
118
|
|
|
{
|
|
119
|
|
|
$this->targetTeam = $targetTeam;
|
|
120
|
|
|
}
|
|
121
|
|
|
|
|
122
|
|
|
/**
|
|
123
|
|
|
* @return int
|
|
124
|
|
|
*/
|
|
125
|
|
|
public function getAmount()
|
|
126
|
|
|
{
|
|
127
|
|
|
return $this->amount;
|
|
128
|
|
|
}
|
|
129
|
|
|
|
|
130
|
|
|
/**
|
|
131
|
|
|
* @param int $amount
|
|
132
|
|
|
*/
|
|
133
|
|
|
public function setAmount($amount)
|
|
134
|
|
|
{
|
|
135
|
|
|
$this->amount = $amount;
|
|
136
|
|
|
}
|
|
137
|
|
|
|
|
138
|
|
|
/**
|
|
139
|
|
|
* @return int
|
|
140
|
|
|
*/
|
|
141
|
|
|
public function getSeason()
|
|
142
|
|
|
{
|
|
143
|
|
|
return $this->season;
|
|
144
|
|
|
}
|
|
145
|
|
|
|
|
146
|
|
|
/**
|
|
147
|
|
|
* @param int $season
|
|
148
|
|
|
*/
|
|
149
|
|
|
public function setSeason($season)
|
|
150
|
|
|
{
|
|
151
|
|
|
$this->season = $season;
|
|
152
|
|
|
}
|
|
153
|
|
|
}
|
|
154
|
|
|
|