|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the ONGR package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace ONGR\CurrencyExchangeBundle\Document; |
|
13
|
|
|
|
|
14
|
|
|
use ONGR\ElasticsearchBundle\Annotation as ES; |
|
15
|
|
|
use ONGR\ElasticsearchBundle\Collection\Collection; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Stores currency rates. |
|
19
|
|
|
* |
|
20
|
|
|
* @ES\Document(type="currency") |
|
21
|
|
|
*/ |
|
22
|
|
|
class CurrencyDocument |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var RatesObject |
|
26
|
|
|
* |
|
27
|
|
|
* @ES\Embedded(class="ONGRCurrencyExchangeBundle:RatesObject", multiple=true) |
|
28
|
|
|
*/ |
|
29
|
|
|
private $rates; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var \DateTime |
|
33
|
|
|
* |
|
34
|
|
|
* @ES\Property(type="date") |
|
35
|
|
|
*/ |
|
36
|
|
|
private $createdAt; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var \DateTime |
|
40
|
|
|
* |
|
41
|
|
|
* @ES\Property(type="date", options={"format":"strict_date"}) |
|
42
|
|
|
*/ |
|
43
|
|
|
private $date; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* CurrencyDocument constructor. |
|
47
|
|
|
*/ |
|
48
|
|
|
public function __construct() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->rates = new Collection(); |
|
|
|
|
|
|
51
|
|
|
$this->createdAt = new \DateTime(); |
|
52
|
|
|
$this->date = date('Y-m-d'); |
|
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return RatesObject |
|
57
|
|
|
*/ |
|
58
|
|
|
public function getRates() |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->rates; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @param RatesObject $rates |
|
65
|
3 |
|
*/ |
|
66
|
|
|
public function setRates($rates) |
|
67
|
3 |
|
{ |
|
68
|
3 |
|
$this->rates = $rates; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param RatesObject $rate |
|
73
|
|
|
*/ |
|
74
|
|
|
public function addRate($rate) |
|
75
|
|
|
{ |
|
76
|
|
|
$this->rates[] = $rate; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return \DateTime |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getCreatedAt() |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->createdAt; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @param \DateTime $createdAt |
|
89
|
|
|
*/ |
|
90
|
|
|
public function setCreatedAt($createdAt) |
|
91
|
|
|
{ |
|
92
|
|
|
$this->createdAt = $createdAt; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @return \DateTime |
|
97
|
|
|
*/ |
|
98
|
|
|
public function getDate() |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->date; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @param string $date |
|
105
|
|
|
*/ |
|
106
|
|
|
public function setDate($date) |
|
107
|
|
|
{ |
|
108
|
|
|
$this->date = $date; |
|
|
|
|
|
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..