PHP code example of linio / doctrine-service-provider

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

    

linio / doctrine-service-provider example snippets




use Linio\Doctrine\Provider\OrmServiceProvider;
use Linio\Doctrine\Provider\DbalServiceProvider;
use Pimple\Container;

$container = new Container();

$container->register(new DbalServiceProvider, [
    'db.options' => [
        'driver' => 'pdo_sqlite',
        'path' => '/path/to/sqlite.db',
    ],
]);

$container->register(new OrmServiceProvider, [
    'orm.proxies_dir' => '/path/to/proxies',
    'orm.em.options' => [
        'mappings' => [
            // Using actual filesystem paths
            [
                'type' => 'annotation',
                'namespace' => 'Foo\Entities',
                'path' => __DIR__.'/src/Foo/Entities',
            ],
            [
                'type' => 'xml',
                'namespace' => 'Bat\Entities',
                'path' => __DIR__.'/src/Bat/Resources/mappings',
            ],
        ],
        'resolve_target_entities' => [
            'Rocket\Auth\Model\User' => 'MyProject\Model\Customer',
            'Rocket\Auth\Model\Session' => 'MyProject\Model\Session',
            'Rocket\Auth\Model\OAuthCredentials' => 'MyProject\Model\OAuthCredentials',
            'Rocket\Auth\Model\SessionContext' => 'MyProject\Model\SessionContext',
        ],
    ],
]);