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
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Donation |
11
|
|
|
* |
12
|
|
|
* @ORM\Table(name="cpt_compta") |
13
|
|
|
* @ORM\Entity |
14
|
|
|
*/ |
15
|
|
|
class Compta implements TimestampableInterface |
16
|
|
|
{ |
17
|
|
|
use TimestampableTrait; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @var integer |
21
|
|
|
* |
22
|
|
|
* @ORM\Column(name="id", type="integer") |
23
|
|
|
* @ORM\Id |
24
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
25
|
|
|
*/ |
26
|
|
|
private $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(name="value", type="decimal", precision=7, scale=2) |
30
|
|
|
*/ |
31
|
|
|
private $value; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
* |
36
|
|
|
* @ORM\Column(name="month", type="string") |
37
|
|
|
*/ |
38
|
|
|
private $month; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var Source |
42
|
|
|
* @ORM\ManyToOne(targetEntity="ProjetNormandie\ComptaBundle\Entity\Source", fetch="EAGER")) |
43
|
|
|
* @ORM\JoinColumns({ |
44
|
|
|
* @ORM\JoinColumn(name="idSource", referencedColumnName="id", nullable=false) |
45
|
|
|
* }) |
46
|
|
|
*/ |
47
|
|
|
private $source; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var Type |
51
|
|
|
* @ORM\ManyToOne(targetEntity="ProjetNormandie\ComptaBundle\Entity\Type", fetch="EAGER")) |
52
|
|
|
* @ORM\JoinColumns({ |
53
|
|
|
* @ORM\JoinColumn(name="idType", referencedColumnName="id", nullable=false) |
54
|
|
|
* }) |
55
|
|
|
*/ |
56
|
|
|
private $type; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Get id |
60
|
|
|
* |
61
|
|
|
* @return integer |
62
|
|
|
*/ |
63
|
|
|
public function getId() |
64
|
|
|
{ |
65
|
|
|
return $this->id; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Set id |
70
|
|
|
* |
71
|
|
|
* @param int $id |
72
|
|
|
* @return $this |
73
|
|
|
*/ |
74
|
|
|
public function setId($id) |
75
|
|
|
{ |
76
|
|
|
$this->id = $id; |
77
|
|
|
|
78
|
|
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get value |
83
|
|
|
* |
84
|
|
|
* @return double |
85
|
|
|
*/ |
86
|
|
|
public function getValue() |
87
|
|
|
{ |
88
|
|
|
return $this->value; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Set value |
93
|
|
|
* |
94
|
|
|
* @param double $value |
95
|
|
|
* @return $this |
96
|
|
|
*/ |
97
|
|
|
public function setValue($value) |
98
|
|
|
{ |
99
|
|
|
$this->value = $value; |
100
|
|
|
|
101
|
|
|
return $this; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Get month |
106
|
|
|
* |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
|
|
public function getMonth() |
110
|
|
|
{ |
111
|
|
|
return $this->month; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Set month |
116
|
|
|
* |
117
|
|
|
* @param string $month |
118
|
|
|
* @return $this |
119
|
|
|
*/ |
120
|
|
|
public function setMonth($month) |
121
|
|
|
{ |
122
|
|
|
$this->month = $month; |
123
|
|
|
|
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* Get source |
130
|
|
|
* @return Source |
131
|
|
|
*/ |
132
|
|
|
public function getSource() |
133
|
|
|
{ |
134
|
|
|
return $this->source; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Set source |
139
|
|
|
* |
140
|
|
|
* @param Source $source |
141
|
|
|
* @return $this |
142
|
|
|
*/ |
143
|
|
|
public function setSource($source) |
144
|
|
|
{ |
145
|
|
|
$this->source = $source; |
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Get type |
151
|
|
|
* @return Type |
152
|
|
|
*/ |
153
|
|
|
public function getType() |
154
|
|
|
{ |
155
|
|
|
return $this->type; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Set type |
160
|
|
|
* |
161
|
|
|
* @param Type $type |
162
|
|
|
* @return $this |
163
|
|
|
*/ |
164
|
|
|
public function setType($type) |
165
|
|
|
{ |
166
|
|
|
$this->type = $type; |
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @return string |
172
|
|
|
*/ |
173
|
|
|
public function __toString() |
174
|
|
|
{ |
175
|
|
|
return sprintf('%s %s [%d]', $this->getMonth(), $this->getSource()->getLabel(), $this->getId()); |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
|