PHP code example of stefanotorresi / thorr-persistence

1. Go to this page and download the library: Download stefanotorresi/thorr-persistence library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stefanotorresi / thorr-persistence example snippets


$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);

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