Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Controller\SaleController;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ApiResource(operations: [
new Get(
uriTemplate: '/sale/monthly_average_price_evolution',
controller: SaleController::class,
name: 'monthly_average_price_evolution'
)
])]
/** A sale. */
#[ORM\Entity]
#[ApiResource]
class Sale
{
/** The id of this sale. **/
#[ORM\Id, ORM\Column, ORM\GeneratedValue]
private ?int $id;
/** The date of this sale. */
#[ORM\Column]
private ?\DateTimeImmutable $date;
/** The amount of this sale. */
#[ORM\Column]
private ?float $amount;
/** The surface of this sale. */
#[ORM\Column]
private ?float $surface;
/** The region of this sale. */
#[ORM\Column()]
private ?string $region;
// constructor
public function __construct(
\DateTimeImmutable $date = null,
float $amount = null,
float $surface = null,
string $region = null
) {
$this->date = $date;
$this->amount = $amount;
$this->surface = $surface;
$this->region = $region;
}
// getters
public function getId(): ?int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function getAmount(): ?float
{
return $this->amount;
}
public function getSurface(): ?float
{
return $this->surface;
}
public function getRegion(): ?string
{
return $this->region;
}
// setters
public function setDate(\DateTimeImmutable $date): void
{
$this->date = $date;
}
public function setAmount(float $amount): void
{
$this->amount = $amount;
}
public function setSurface(float $surface): void
{
$this->surface = $surface;
}
public function setRegion(string $region): void
{
$this->region = $region;
}
}