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
<?php
namespace App\Mapper;
use App\Entity\Kitchen;
use App\Entity\Restaurant;
use App\Entity\RestaurantType;
use App\Model\File;
use App\Model\KitchenType;
use App\Model\RestaurantListingElement;
use App\Model\RestaurantType as RestaurantTypeModel;
class RestaurantMapper
{
public static function mapToListElement(Restaurant $restaurant): RestaurantListingElement
{
return new RestaurantListingElement(
$restaurant->getId(),
$restaurant->getName(),
$restaurant->getCode(),
new RestaurantTypeModel(
$restaurant->getTypeId()->getId(),
$restaurant->getTypeId()->getName(),
$restaurant->getTypeId()->getCode()
),
$restaurant->getCheckInfo(),
new File(
1,
"name",
"description",
10,
"jpg",
$restaurant->getPreviewImage()
),
$restaurant->getSite()
);
}
public static function mapToRestaurantType(RestaurantType $restaurantType): RestaurantTypeModel
{
return new RestaurantTypeModel(
$restaurantType->getId(),
$restaurantType->getName(),
$restaurantType->getCode(),
);
}
public static function mapToKitchenType(Kitchen $kitchen): KitchenType
{
return new KitchenType(
$kitchen->getId(),
$kitchen->getName()
);
}
}