Step 00 — Squelette + intégration naïve
3 Bounded Contexts (Sales, Invoicing, LegacyFulfillment) avec : - Domaines complets (agrégats, VOs, événements, invariants) - Couche application (commands, queries, ports) - Infrastructure in-memory (repos, gateway fake) - Controllers HTTP Symfony - Couplage naïf synchrone entre BC via NaiveSalesEventPublisher - 20 tests unitaires et d'intégration passants
This commit is contained in:
11
apps/symfony/config/packages/framework.yaml
Normal file
11
apps/symfony/config/packages/framework.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
framework:
|
||||
secret: '%env(APP_SECRET)%'
|
||||
test: ~
|
||||
http_method_override: false
|
||||
handle_all_throwables: true
|
||||
php_errors:
|
||||
log: true
|
||||
|
||||
when@test:
|
||||
framework:
|
||||
test: true
|
||||
5
apps/symfony/config/routes.yaml
Normal file
5
apps/symfony/config/routes.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
controllers:
|
||||
resource:
|
||||
path: ../../../src/
|
||||
namespace: MiniShop
|
||||
type: attribute
|
||||
62
apps/symfony/config/services.yaml
Normal file
62
apps/symfony/config/services.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
services:
|
||||
_defaults:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
# --- Shared ---
|
||||
MiniShop\Shared\:
|
||||
resource: '%kernel.project_dir%/src/Shared/'
|
||||
|
||||
MiniShop\Shared\Technical\Clock:
|
||||
alias: MiniShop\Shared\Technical\SystemClock
|
||||
|
||||
# --- Sales ---
|
||||
MiniShop\Sales\Application\:
|
||||
resource: '%kernel.project_dir%/src/Sales/Application/'
|
||||
|
||||
MiniShop\Sales\Infrastructure\:
|
||||
resource: '%kernel.project_dir%/src/Sales/Infrastructure/'
|
||||
|
||||
MiniShop\Sales\Interfaces\:
|
||||
resource: '%kernel.project_dir%/src/Sales/Interfaces/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
MiniShop\Sales\Application\Port\OrderRepository:
|
||||
alias: MiniShop\Sales\Infrastructure\Persistence\InMemoryOrderRepository
|
||||
|
||||
MiniShop\Sales\Application\Port\SalesEventPublisher:
|
||||
alias: MiniShop\Sales\Infrastructure\Messaging\NaiveSalesEventPublisher
|
||||
|
||||
# --- Invoicing ---
|
||||
MiniShop\Invoicing\Application\:
|
||||
resource: '%kernel.project_dir%/src/Invoicing/Application/'
|
||||
|
||||
MiniShop\Invoicing\Infrastructure\:
|
||||
resource: '%kernel.project_dir%/src/Invoicing/Infrastructure/'
|
||||
|
||||
MiniShop\Invoicing\Interfaces\:
|
||||
resource: '%kernel.project_dir%/src/Invoicing/Interfaces/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
MiniShop\Invoicing\Application\Port\InvoiceRepository:
|
||||
alias: MiniShop\Invoicing\Infrastructure\Persistence\InMemoryInvoiceRepository
|
||||
|
||||
MiniShop\Invoicing\Application\Port\InvoiceNumberGenerator:
|
||||
alias: MiniShop\Invoicing\Infrastructure\SequentialInvoiceNumberGenerator
|
||||
|
||||
# --- LegacyFulfillment ---
|
||||
MiniShop\LegacyFulfillment\Application\:
|
||||
resource: '%kernel.project_dir%/src/LegacyFulfillment/Application/'
|
||||
|
||||
MiniShop\LegacyFulfillment\Infrastructure\:
|
||||
resource: '%kernel.project_dir%/src/LegacyFulfillment/Infrastructure/'
|
||||
|
||||
MiniShop\LegacyFulfillment\Interfaces\:
|
||||
resource: '%kernel.project_dir%/src/LegacyFulfillment/Interfaces/'
|
||||
tags: ['controller.service_arguments']
|
||||
|
||||
MiniShop\LegacyFulfillment\Application\Port\ShipmentRequestRepository:
|
||||
alias: MiniShop\LegacyFulfillment\Infrastructure\Persistence\InMemoryShipmentRequestRepository
|
||||
|
||||
MiniShop\LegacyFulfillment\Application\Port\LegacyFulfillmentGateway:
|
||||
alias: MiniShop\LegacyFulfillment\Infrastructure\Gateway\FakeLegacyFulfillmentGateway
|
||||
17
apps/symfony/public/index.php
Normal file
17
apps/symfony/public/index.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/vendor/autoload.php';
|
||||
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__, 3) . '/.env');
|
||||
|
||||
$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', (bool) ($_SERVER['APP_DEBUG'] ?? true));
|
||||
$request = Request::createFromGlobals();
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
28
apps/symfony/src/Kernel.php
Normal file
28
apps/symfony/src/Kernel.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
|
||||
final class Kernel extends BaseKernel
|
||||
{
|
||||
use MicroKernelTrait;
|
||||
|
||||
public function getConfigDir(): string
|
||||
{
|
||||
return $this->getProjectDir() . '/apps/symfony/config';
|
||||
}
|
||||
|
||||
public function getCacheDir(): string
|
||||
{
|
||||
return $this->getProjectDir() . '/apps/symfony/var/cache/' . $this->environment;
|
||||
}
|
||||
|
||||
public function getLogDir(): string
|
||||
{
|
||||
return $this->getProjectDir() . '/apps/symfony/var/log';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user