vsmoraes/dynamo-mapper

Map data objects into dynamo queries

dev-master 2016-07-19 14:24 UTC

This package is auto-updated.

Last update: 2024-10-29 04:31:08 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License

A simple wrapper so you can use your own entities with dynamodb

Instalation

The package is available on Packagist. Autoloading is PSR-4 compatible.

composer require vsmoraes/dynamo-mapper

Or add it directly to you composer.json file

{
    "require": {
        "vsmoraes/dynamo-mapper": "dev-master"
    }
}

Usage

$data = [
    'id' => ['N' => '1'],
    'name' => ['S' => 'Foo'],
    'gender' => ['S' => 'male'],
    'active' => ['BOOL' => true]
];

$entity = (new Mapper(new Factory()))->getFilledEntity(new Person(), $data);
$entity = (new Person())->setId(1)
    ->setName('Foo');
$entity->gender = 'male';

$dynamoEntry = (new Mapper(new Factory()))->getEntityData($entity);

License

MIT License