PHP code example of maurice2k / mezzio-doctrine

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

    

maurice2k / mezzio-doctrine example snippets


$aggregator = new ConfigAggregator([
    \Maurice2k\MezzioDoctrine\ConfigProvider::class,
    // ...
]);

return [
    'doctrine' => [
        'connection' => [
            'orm_default' => [
                'params' => [
                    'driverClass' => \Doctrine\DBAL\Driver\PDO\MySQL\Driver::class,
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'mydb',
                ],
            ],
        ],
        'driver' => [
            'orm_default' => [
                'class'   => \Doctrine\Persistence\Mapping\Driver\MappingDriverChain::class,
                'drivers' => [
                    'App\\Entity' => [
                        'class' => \Doctrine\ORM\Mapping\Driver\AttributeDriver::class,
                        'paths' => [__DIR__ . '/../../src/App/Entity'],
                    ],
                ],
            ],
        ],
        'configuration' => [
            'orm_default' => [
                'proxy_dir'       => 'data/cache/DoctrineORMProxy',
                'proxy_namespace' => 'DoctrineORMProxy',
            ],
        ],
        'event_manager' => [
            'orm_default' => [
                'subscribers' => [],
                'listeners'   => [],
            ],
        ],
    ],
];

'doctrine' => [
    'connection' => [
        'orm_default' => [ /* ... */ ],
        'orm_reporting' => [ /* ... */ ],
    ],
    // same for driver, configuration, entity_manager, event_manager
],