2017 © Pedro Peláez
 

library data-repository

repository php library

image

g4/data-repository

repository php library

  • Thursday, May 31, 2018
  • by g4code
  • Repository
  • 13 Watchers
  • 0 Stars
  • 2,766 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 29 % Grown

The README.md

data-repository

data-repository - repository library for php. * database storage with data-mapper * caching with russian-doll * in-memory data store with identity-map, (*1)

Install

Install through composer package manager. Find it on packagist., (*2)

composer require g4/data-repository

Dependencies: * g4/data-mapper * g4/russian-doll * g4/identity-map, (*3)

Usage

Check data-mapper docs for details - data-mapper, (*4)

Check russian-doll docs for details - russian-doll, (*5)

Check identity-map docs for details - identity-map, (*6)


use G4\DataMapper\Builder; use G4\DataMapper\Common\Identity; use G4\DataMapper\Common\MappingInterface; use G4\DataMapper\Engine\MySQL\MySQLAdapter; use G4\DataMapper\Engine\MySQL\MySQLClientFactory; use G4\DataRepository\DataRepositoryFactory; use G4\IdentityMap\IdentityMap; use G4\Mcache\McacheFactory; use G4\RussianDoll\Key; use G4\RussianDoll\RussianDoll; // Create instance $dataRepository = (new DataRepositoryFactory( Builder::create()->adapter(new MySQLAdapter(new MySQLClientFactory([]))), new RussianDoll(McacheFactory::createInstance('__driver_name__', [], '__prefix__')), new IdentityMap() ))->create(); // Read flow with: data-mapper's mysql engine, russian-doll and identity-map $identity = new Identity(); $identity ->field('__field_name__') ->equal('__field_value__'); $response = $dataRepository ->setDatasetName('__table_name__') ->setIdentity($identity) ->setIdentityMapKey('__table_name__', '__field_name__', '__field_value__') ->setRussianDollKey(new Key('__table_name__', '__field_name__', '__field_value__')) ->select(); // Write flow (insert, update, upsert, delete) with: data-mapper's mysql engine, russian-doll, and identity-map $identity = new Identity(); $identity ->field('__field_name__') ->equal('__field_value__'); $this->repository ->setDatasetName('__table_name__') ->setMapping(new Mapp())) // must implement mapping ->insert(); $dataRepository ->setDatasetName('__table_name__') ->setIdentity($identity) ->setIdentityMapKey('__table_name__', '__field_name__', '__field_value__') ->setRussianDollKey(new Key('__table_name__', '__field_name__', '__field_value__')) ->setMapping(new Mapp())) // must implement mapping ->update(); $this->repository ->setDatasetName('__table_name__') ->setIdentity($identity) ->setIdentityMapKey('__table_name__', '__field_name__', '__field_value__') ->setRussianDollKey(new Key('__table_name__', '__field_name__', '__field_value__')) ->setMapping(new Mapp())) // must implement mapping ->upsert(); $this->repository ->setDatasetName('__table_name__') ->setIdentity($identity) ->setIdentityMapKey('__table_name__', '__field_name__', '__field_value__') ->setRussianDollKey(new Key('__table_name__', '__field_name__', '__field_value__')) ->delete(); $this->repository ->setDatasetName('__table_name__') ->setIdentityMapKey('__table_name__') ->setRussianDollKey(new Key('__table_name__')) ->query('SELECT * FROM __table_name__'); $this->repository ->setDatasetName('__table_name__') ->setIdentityMapKey('__table_name__', '__field_name__', '__field_value__') ->setRussianDollKey(new Key('__table_name__', '__field_name__', '__field_value__')) ->command('DELETE FROM __table_name__ WHERE __field_name__ = __field_value__');

Development

Install dependencies

$ composer install

Run tests

$ composer unit-test

License

(The MIT License) see LICENSE file for details..., (*7)

The Versions

31/05 2018

dev-master

9999999-dev

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

28/05 2018

1.3.3

1.3.3.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

11/05 2018

1.3.2

1.3.2.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

11/05 2018

1.3.1

1.3.1.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

09/05 2018

1.3.0

1.3.0.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

23/03 2018

dev-release/1.2.0

dev-release/1.2.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

23/03 2018

1.2.0

1.2.0.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

18/01 2018

1.1.0

1.1.0.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

29/12 2017

1.0.2

1.0.2.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

16/11 2017

1.0.1

1.0.1.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository

10/10 2017

1.0.0

1.0.0.0

repository php library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Drasko Gomboc
by Dejan Samardzija
by Ivan Krickovic
by Zeljko Simic

repository cache gateway http memory data-repository