|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by IntelliJ IDEA. |
|
4
|
|
|
* User: gerk |
|
5
|
|
|
* Date: 30.03.17 |
|
6
|
|
|
* Time: 08:32 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace PeekAndPoke\Component\Slumber\Data\MongoDb; |
|
10
|
|
|
|
|
11
|
|
|
use PeekAndPoke\Component\Slumber\Annotation\Slumber; |
|
12
|
|
|
use PeekAndPoke\Component\Slumber\Core; |
|
13
|
|
|
use PeekAndPoke\Component\Slumber\Core\LookUp\PropertyMarker2Mapper; |
|
14
|
|
|
use PeekAndPoke\Component\Slumber\Data\MongoDb; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @author Karsten J. Gerber <[email protected]> |
|
18
|
|
|
*/ |
|
19
|
|
|
class MongoDbPropertyMarkerToMapper extends PropertyMarker2Mapper |
|
20
|
|
|
{ |
|
21
|
|
|
public function __construct() |
|
22
|
|
|
{ |
|
23
|
|
|
parent::__construct( |
|
24
|
|
|
Core\Codec\Property\AsIsMapper::class, |
|
25
|
|
|
[ |
|
26
|
|
|
// nested objects and collections of nested objects |
|
27
|
|
|
Slumber\AsObject::class => Core\Codec\Property\ObjectMapper::class, |
|
28
|
|
|
Slumber\AsList::class => Core\Codec\Property\ListMapper::class, |
|
29
|
|
|
Slumber\AsMap::class => Core\Codec\Property\MapMapper::class, |
|
30
|
|
|
Slumber\AsKeyValuePairs::class => Core\Codec\Property\KeyValuePairsMapper::class, |
|
31
|
|
|
// no mapping |
|
32
|
|
|
Slumber\AsIs::class => Core\Codec\Property\AsIsMapper::class, |
|
33
|
|
|
// primitive types |
|
34
|
|
|
Slumber\AsBool::class => Core\Codec\Property\BoolMapper::class, |
|
35
|
|
|
Slumber\AsDecimal::class => Core\Codec\Property\DecimalMapper::class, |
|
36
|
|
|
Slumber\AsInteger::class => Core\Codec\Property\IntegerMapper::class, |
|
37
|
|
|
Slumber\AsString::class => Core\Codec\Property\StringMapper::class, |
|
38
|
|
|
// object and other common types |
|
39
|
|
|
Slumber\AsEnum::class => Core\Codec\Property\EnumMapper::class, |
|
40
|
|
|
Slumber\AsSimpleDate::class => MongoDb\Types\SimpleDateMapper::class, |
|
41
|
|
|
Slumber\AsLocalDate::class => MongoDb\Types\LocalDateMapper::class, |
|
42
|
|
|
// geo json |
|
43
|
|
|
Slumber\GeoJson\AsPoint::class => Core\Codec\Property\GeoJson\PointMapper::class, |
|
44
|
|
|
Slumber\GeoJson\AsLineString::class => Core\Codec\Property\GeoJson\LineStringMapper::class, |
|
45
|
|
|
] |
|
46
|
|
|
); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
} |
|
50
|
|
|
|