PHP code example of streamcommon / doctrine-manager
1. Go to this page and download the library: Download streamcommon/doctrine-manager 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/ */
streamcommon / doctrine-manager example snippets
'config' => [
'doctrine' => [
'configuration' => [
// If you use single connection
'orm_default' => [
'result_cache' => 'array',
'metadata_cache' => 'array',
'query_cache' => 'array',
'hydration_cache' => 'array',
'driver' => 'orm_default',
],
// If you want to add a second connection
'orm_custom' => [
'result_cache' => 'memcached',
'metadata_cache' => 'memcached',
'query_cache' => 'memcached',
'hydration_cache' => 'memcached',
'driver' => 'orm_custom',
],
],
'connection' => [
// If you use single connection
// Default using MySql connection
'orm_default' => [
'configuration' => 'orm_default',
'event_manager' => 'orm_default',
'params' => [
'dbname' => 'name',
'user' => 'user',
'password' => 'password',
'host' => 'localhost',
],
],
// If you want to add a second connection
// Alternative Postgress connection
'orm_custom' => [
'configuration' => 'orm_custom',
'event_manager' => 'orm_custom',
'driver_class_name' => \Doctrine\DBAL\Driver\PDOPgSql\Driver::class,
'params' => [
'dbname' => 'name',
'user' => 'user',
'password' => 'password',
'host' => 'localhost_custom',
],
]
],
use Streamcommon\Doctrine\Manager\ConfigProvider;
use Laminas\ServiceManager\ServiceManager;
$config = new ConfigProvider();
$config = $config();
$dependencies = $config['dependencies'];
$dependencies['services']['config'] = $config;
return new ServiceManager($dependencies);
use JSoumelidis\SymfonyDI\Config\{Config as SymfonyConfig, ContainerFactory as SymfonyContainerFactory};
use Streamcommon\Doctrine\Manager\ConfigProvider;
$config = new ConfigProvider();
$config = $config();
$dependencies = $config['dependencies'];
$dependencies['services']['config'] = $config;
$container = new SymfonyContainerFactory();
return $container(new SymfonyConfig($dependencies))
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.