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\GeneratedValue; |
10
|
|
|
use Doctrine\ORM\Mapping\Id; |
11
|
|
|
use Doctrine\ORM\Mapping\JoinColumn; |
12
|
|
|
use Doctrine\ORM\Mapping\ManyToOne; |
13
|
|
|
use Doctrine\ORM\Mapping\Table; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @Entity(repositoryClass="Stu\Orm\Repository\UserAwardRepository") |
17
|
|
|
* @Table( |
18
|
|
|
* name="stu_user_award" |
19
|
|
|
* ) |
20
|
|
|
**/ |
21
|
|
|
class UserAward implements UserAwardInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @Id |
25
|
|
|
* @Column(type="integer") |
26
|
|
|
* @GeneratedValue(strategy="IDENTITY") |
27
|
|
|
* |
28
|
|
|
*/ |
29
|
|
|
private int $id; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @Column(type="integer") |
33
|
|
|
* |
34
|
|
|
*/ |
35
|
|
|
private int $user_id = 0; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @Column(type="integer") |
39
|
|
|
* |
40
|
|
|
*/ |
41
|
|
|
private int $award_id; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* |
45
|
|
|
* @ManyToOne(targetEntity="User") |
46
|
|
|
* @JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") |
47
|
|
|
*/ |
48
|
|
|
private UserInterface $user; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* |
52
|
|
|
* @ManyToOne(targetEntity="Award") |
53
|
|
|
* @JoinColumn(name="award_id", referencedColumnName="id", onDelete="CASCADE") |
54
|
|
|
*/ |
55
|
|
|
private AwardInterface $award; |
56
|
|
|
|
57
|
|
|
public function getId(): int |
58
|
|
|
{ |
59
|
|
|
return $this->id; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function getUserId(): int |
63
|
|
|
{ |
64
|
|
|
return $this->user_id; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function getUser(): UserInterface |
68
|
|
|
{ |
69
|
|
|
return $this->user; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function setUser(UserInterface $user): UserAwardInterface |
73
|
|
|
{ |
74
|
|
|
$this->user = $user; |
75
|
|
|
return $this; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function getAwardId(): int |
79
|
|
|
{ |
80
|
|
|
return $this->award_id; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function getAward(): AwardInterface |
84
|
|
|
{ |
85
|
|
|
return $this->award; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function setAward(AwardInterface $award): UserAwardInterface |
89
|
|
|
{ |
90
|
|
|
$this->award = $award; |
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|