-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add usage documentation with examples (#4)
* Add Usage documentation with examples * Add query builder docs --------- Co-authored-by: Andrey Semikov <[email protected]>
- Loading branch information
Showing
5 changed files
with
586 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); |
Oops, something went wrong.