1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Del\Expenses\Entity; |
4
|
|
|
|
5
|
|
|
use DateTime; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @Entity(repositoryClass="Del\Expenses\Repository\Entry") |
9
|
|
|
* @InheritanceType("SINGLE_TABLE") |
10
|
|
|
* @DiscriminatorColumn(name="type", type="string") |
11
|
|
|
* @DiscriminatorMap({"IN" = "Del\Expenses\Entity\Income", "OUT" = "Del\Expenses\Entity\Expenditure", "CLAIM" = "Del\Expenses\Entity\ExpenseClaim"}) |
12
|
|
|
*/ |
13
|
|
|
abstract class Entry implements EntryInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* @Id |
17
|
|
|
* @Column(type="integer") |
18
|
|
|
* @GeneratedValue |
19
|
|
|
*/ |
20
|
|
|
private $id; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @Column(type="integer") |
24
|
|
|
*/ |
25
|
|
|
private $userId; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @Column(type="datetime") |
29
|
|
|
* @var DateTime |
30
|
|
|
*/ |
31
|
|
|
private $date; |
32
|
|
|
|
33
|
|
|
/** @Column(type="decimal",precision=11,scale=2) */ |
34
|
|
|
private $amount; |
35
|
|
|
|
36
|
|
|
/** @Column(type="string",length=50,nullable=true) */ |
37
|
|
|
private $category; |
38
|
|
|
|
39
|
|
|
/** @Column(type="string",length=50,nullable=true) */ |
40
|
|
|
private $description; |
41
|
|
|
|
42
|
|
|
/** @Column(type="string",length=255,nullable=true) */ |
43
|
|
|
private $note; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return int |
47
|
|
|
*/ |
48
|
5 |
|
public function getId() |
49
|
|
|
{ |
50
|
5 |
|
return $this->id; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param int $id |
55
|
|
|
* @return Entry |
56
|
|
|
*/ |
57
|
9 |
|
public function setId($id) |
58
|
|
|
{ |
59
|
9 |
|
$this->id = (int) $id; |
60
|
9 |
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return mixed |
65
|
|
|
*/ |
66
|
5 |
|
public function getUserId() |
67
|
|
|
{ |
68
|
5 |
|
return $this->userId; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param mixed $userId |
73
|
|
|
* @return Entry |
74
|
|
|
*/ |
75
|
9 |
|
public function setUserId($userId) |
76
|
|
|
{ |
77
|
9 |
|
$this->userId = $userId; |
78
|
9 |
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return DateTime |
85
|
|
|
*/ |
86
|
2 |
|
public function getDate() |
87
|
|
|
{ |
88
|
2 |
|
return $this->date; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param DateTime $date |
93
|
|
|
* @return Entry |
94
|
|
|
*/ |
95
|
9 |
|
public function setDate(DateTime $date) |
96
|
|
|
{ |
97
|
9 |
|
$this->date = $date; |
98
|
9 |
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return float |
103
|
|
|
*/ |
104
|
2 |
|
public function getAmount() |
105
|
|
|
{ |
106
|
2 |
|
return $this->amount; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param float $amount |
111
|
|
|
* @return Entry |
112
|
|
|
*/ |
113
|
9 |
|
public function setAmount($amount) |
114
|
|
|
{ |
115
|
9 |
|
$this->amount = $amount; |
116
|
9 |
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return string |
121
|
|
|
*/ |
122
|
2 |
|
public function getCategory() |
123
|
|
|
{ |
124
|
2 |
|
return $this->category; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @param string $category |
129
|
|
|
* @return Entry |
130
|
|
|
*/ |
131
|
9 |
|
public function setCategory($category) |
132
|
|
|
{ |
133
|
9 |
|
$this->category = $category; |
134
|
9 |
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return string |
139
|
|
|
*/ |
140
|
2 |
|
public function getDescription() |
141
|
|
|
{ |
142
|
2 |
|
return $this->description; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param string $description |
147
|
|
|
* @return Entry |
148
|
|
|
*/ |
149
|
9 |
|
public function setDescription($description) |
150
|
|
|
{ |
151
|
9 |
|
$this->description = $description; |
152
|
9 |
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
2 |
|
public function getNote() |
159
|
|
|
{ |
160
|
2 |
|
return $this->note; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/** |
164
|
|
|
* @param string $note |
165
|
|
|
* @return Entry |
166
|
|
|
*/ |
167
|
9 |
|
public function setNote($note) |
168
|
|
|
{ |
169
|
9 |
|
$this->note = $note; |
170
|
9 |
|
return $this; |
171
|
|
|
} |
172
|
|
|
} |