collection-crud/config/packages/doctrine.php

39 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
use App\Types\MoneyType;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set('env(DATABASE_URL)', '');
$containerConfigurator->extension('doctrine', [
'dbal' => [
'driver' => 'pdo_pgsql',
'types' => ['money' => MoneyType::class],
'logging' => '%kernel.debug%',
'mapping_types' => ['bit' => 'boolean', 'money' => 'money'],
'url' => '%env(DATABASE_URL)%',
],
'orm' => [
'auto_generate_proxy_classes' => '%kernel.debug%',
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware',
'auto_mapping' => TRUE,
'enable_lazy_ghost_objects' => TRUE,
'mappings' => [
'App' => [
'is_bundle' => FALSE,
'type' => 'attribute',
'dir' => '%kernel.project_dir%/src/Entity',
'prefix' => 'App\Entity',
'alias' => 'App'],
],
'controller_resolver' => [
'auto_mapping' => true,
],
],
]);
};