You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
use DI\Container;
|
|
use Doctrine\ORM\Configuration;
|
|
use Doctrine\ORM\EntityManager;
|
|
use Doctrine\ORM\Tools\Setup;
|
|
use Twig\Loader\FilesystemLoader;
|
|
use Twig\Loader\LoaderInterface;
|
|
use function DI\autowire;
|
|
use function DI\factory;
|
|
use function DI\get;
|
|
|
|
return [
|
|
'app.name' => 'CubiStore',
|
|
'app.description' => 'Hello world, ya we signing',
|
|
'app.domain' => 'localhost:8888',
|
|
|
|
'doctrine.connection' => [
|
|
'driver' => 'pdo_sqlite',
|
|
'path' => __DIR__ . '/../var/db.sqlite'
|
|
],
|
|
|
|
'twig.views' => __DIR__ . '/../views',
|
|
'env.is_dev' => factory(function () {
|
|
return $_ENV['ENV'] !== 'prod';
|
|
}),
|
|
'twig.config' => factory(function (Container $container) {
|
|
return [
|
|
'debug' => $container->get('env.is_dev'),
|
|
'cache' => __DIR__ . '/../var/cache/views'
|
|
];
|
|
}),
|
|
|
|
// Twig
|
|
Twig\Environment::class => autowire()->constructorParameter(1, get('twig.config')),
|
|
FilesystemLoader::class => autowire()->constructorParameter(0, get('twig.views')),
|
|
LoaderInterface::class => get(FilesystemLoader::class),
|
|
|
|
// Doctrine
|
|
Configuration::class => factory(function (Container $container) {
|
|
return Setup::createAnnotationMetadataConfiguration(
|
|
[__DIR__ . '/../src/Model'],
|
|
$container->get('env.is_dev'),
|
|
null,
|
|
null,
|
|
false
|
|
);
|
|
}),
|
|
EntityManager::class => factory([EntityManager::class, 'create'])
|
|
->parameter('connection', get('doctrine.connection'))
|
|
]; |