2017 © Pedro Peláez
 

library thorr-persistence

Agnostic interfaces for a DataMapper implementation through vendor specific adapters

image

stefanotorresi/thorr-persistence

Agnostic interfaces for a DataMapper implementation through vendor specific adapters

  • Saturday, October 29, 2016
  • by stefanotorresi
  • Repository
  • 1 Watchers
  • 2 Stars
  • 504 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Thorr\Persistence

Latest Stable Version Latest Unstable Version Build Status Code Coverage Scrutinizer Code Quality, (*1)

Agnostic interfaces for a DataMapper implementation through vendor specific adapters., (*2)

Implementations

DataMapperManager usage

This library provides an optional Zend Framework 2 plugin manager for DataMapperInterface instances, the DataMapperManager., (*3)

It provides a method to retrieve data mappers for your entities: DataMapperManager::getDataMapperForEntity($entity)., (*4)

Here is an example:, (*5)

$config = new DataMapperManagerConfig([
    'entity_data_mapper_map' => [
        Entity::class => 'EntityDataMapperServiceName',
    ],
    'factories' => [
        'EntityDataMapperServiceName' => function () {
            // return a DataMapperInterface            
        },
    ],
]);

$dataMapperManager = new DataMapperManager($config);

// retrieves the service configured as 'EntityDataMapperServiceName'
$entityMapper = $dataMapperManager->getDataMapperForEntity(Entity::class);

To use the DataMapperManager you have to require zendframework/zend-servicemanager via Composer:, (*6)

composer require zendframework/zend-servicemanager

Usage in a ZF2 module

When using the library as a Zend Framework 2 module, you can load the module Thorr\Persistence and implement DataMapperManagerConfigProviderInterface in your modules to provide the configuration via the getDataMapperManagerConfig() method., (*7)

The module will also register in the main ServiceManager a DataMapperManager instance with its FQCN, aliased with the DataMapperManager name, so you can retrieve it as follows:, (*8)

$serviceManager->get(DataMapperManager::class);
// or
$serviceManager->get('DataMapperManager');

The Versions

19/05 2015

1.x-dev

1.9999999.9999999.9999999-dev

Agnostic interfaces for a DataMapper implementation through vendor specific adapters

  Sources   Download

MIT

The Requires

 

The Development Requires

03/03 2015