-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinitialise_client.php
43 lines (33 loc) · 1.25 KB
/
initialise_client.php
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
<?php
declare(strict_types=1);
use Autoprotect\DynamodbODM\Annotation\AnnotationManager;
use Autoprotect\DynamodbODM\Client\DynamodbOperationsClient;
use Autoprotect\DynamodbODM\Hydrator\Hydrator;
use Autoprotect\DynamodbODM\Model\Serializer\Serializer;
use Autoprotect\DynamodbODM\Query\Factory\ExpressionFactory;
use Autoprotect\DynamodbODM\Query\QueryBuilder;
use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Marshaler;
use Doctrine\Common\Annotations\AnnotationReader;
// Init native AWS dynamo Db client
$dynamoDbClient = new DynamoDbClient(array_merge(
[
'region' => 'eu-west-2',
'version' => 'latest',
]
));
// init lib operations client
$client = new DynamodbOperationsClient($dynamoDbClient);
// native marshaller
$marshaler = new Marshaler();
// query builder
$queryBuilder = new QueryBuilder($marshaler, new ExpressionFactory($marshaler));
// annotation reader
$annotationReader = new AnnotationReader();
// annotation manager
$annotationManager = new AnnotationManager($annotationReader);
// various hydrators
$newModelHydrator = new Hydrator(NewModel::class, $annotationManager);
$sortKeyModelHydrator = new Hydrator(SortKeyModel::class, $annotationManager);
// serializer for
$serializer = new Serializer($annotationManager);