1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ProjetNormandie\ComptaBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface; |
7
|
|
|
use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait; |
8
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
9
|
|
|
use DateTime; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Donation |
13
|
|
|
* |
14
|
|
|
* @ORM\Table(name="cpt_donation") |
15
|
|
|
* @ORM\Entity(repositoryClass="ProjetNormandie\ComptaBundle\Repository\DonationRepository") |
16
|
|
|
*/ |
17
|
|
|
class Donation implements TimestampableInterface |
18
|
|
|
{ |
19
|
|
|
use TimestampableTrait; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var integer |
23
|
|
|
* |
24
|
|
|
* @ORM\Column(name="id", type="integer") |
25
|
|
|
* @ORM\Id |
26
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
27
|
|
|
*/ |
28
|
|
|
private $id; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @Assert\NotNull |
32
|
|
|
* @ORM\Column(name="value", type="decimal", precision=7, scale=2) |
33
|
|
|
*/ |
34
|
|
|
private $value; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var DateTime |
38
|
|
|
* |
39
|
|
|
* @ORM\Column(name="dateDonation", type="datetime", nullable=false) |
40
|
|
|
*/ |
41
|
|
|
private $dateDonation; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var UserInterface |
45
|
|
|
* @ORM\ManyToOne(targetEntity="ProjetNormandie\ComptaBundle\Entity\UserInterface", fetch="EAGER")) |
46
|
|
|
* @ORM\JoinColumns({ |
47
|
|
|
* @ORM\JoinColumn(name="idUser", referencedColumnName="id", nullable=true) |
48
|
|
|
* }) |
49
|
|
|
*/ |
50
|
|
|
private $user; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Get id |
54
|
|
|
* |
55
|
|
|
* @return integer |
56
|
|
|
*/ |
57
|
|
|
public function getId() |
58
|
|
|
{ |
59
|
|
|
return $this->id; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Set id |
64
|
|
|
* |
65
|
|
|
* @param int $id |
66
|
|
|
* @return $this |
67
|
|
|
*/ |
68
|
|
|
public function setId($id) |
69
|
|
|
{ |
70
|
|
|
$this->id = $id; |
71
|
|
|
|
72
|
|
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Get value |
77
|
|
|
* |
78
|
|
|
* @return double |
79
|
|
|
*/ |
80
|
|
|
public function getValue() |
81
|
|
|
{ |
82
|
|
|
return $this->value; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Set value |
87
|
|
|
* |
88
|
|
|
* @param int $value |
89
|
|
|
* @return $this |
90
|
|
|
*/ |
91
|
|
|
public function setValue($value) |
92
|
|
|
{ |
93
|
|
|
$this->value = $value; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get dateDonation |
100
|
|
|
* @return DateTime |
101
|
|
|
*/ |
102
|
|
|
public function getDateDonation() |
103
|
|
|
{ |
104
|
|
|
return $this->dateDonation; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Set dateDonation |
109
|
|
|
* |
110
|
|
|
* @param DateTime $dateDonation |
111
|
|
|
* @return $this |
112
|
|
|
*/ |
113
|
|
|
public function setDateDonation($dateDonation) |
114
|
|
|
{ |
115
|
|
|
$this->dateDonation = $dateDonation; |
116
|
|
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Get user |
121
|
|
|
* @return object |
122
|
|
|
*/ |
123
|
|
|
public function getUser() |
124
|
|
|
{ |
125
|
|
|
return $this->user; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Set user |
130
|
|
|
* |
131
|
|
|
* @param object $user |
132
|
|
|
* @return $this |
133
|
|
|
*/ |
134
|
|
|
public function setUser($user) |
135
|
|
|
{ |
136
|
|
|
$this->user = $user; |
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return string |
142
|
|
|
*/ |
143
|
|
|
public function __toString() |
144
|
|
|
{ |
145
|
|
|
return sprintf('[%d]', $this->getId()); |
146
|
|
|
} |
147
|
|
|
} |
148
|
|
|
|