PHP code example of sebrogala / xsv-doctrine

1. Go to this page and download the library: Download sebrogala/xsv-doctrine 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/ */

    

sebrogala / xsv-doctrine example snippets


$configManager = new ConfigManager([
    //...
    Xsv\Doctrine\ConfigProvider::class,
    //...
    new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
]);

$em = $container->get(\Doctrine\ORM\EntityManager::class);

$em = $container->get('entity-manager');



namespace App\Service;

interface SomeEntityManager {}



return [
    'doctrine' => [
        \Doctrine\ORM\EntityManager::class => [
            /* standard config here */
        ],
        \App\Service\SomeEntityManager::class => [
            /* Config for another EntityManager */
        ],
    ],
    'dependencies' => [
        'factories' => [
            \App\Service\SomeEntityManager::class => EntityManagerFactory::class,
        ],
    ],
];

$someEntityManager = $container->get(\App\Service\SomeEntityManager::class);
config/autoload/doctrine.local.php