add chapter about data repositories, and start work on perfomance chapter

This commit is contained in:
lubiana 2022-04-06 01:21:17 +02:00 committed by Andre Lubian
parent eb20213b94
commit 9a1f78947b
165 changed files with 14028 additions and 2028 deletions

View file

@ -1,10 +1,8 @@
<?php declare(strict_types=1);
use Doctrine\ORM\EntityManagerInterface;
use FastRoute\Dispatcher;
use Laminas\Diactoros\ResponseFactory;
use Lubian\NoFramework\Factory\DiactorosRequestFactory;
use Lubian\NoFramework\Factory\DoctrineEm;
use Lubian\NoFramework\Factory\PipelineProvider;
use Lubian\NoFramework\Factory\RequestFactory;
use Lubian\NoFramework\Http\BasicEmitter;
@ -13,8 +11,7 @@ use Lubian\NoFramework\Http\InvokerRoutedHandler;
use Lubian\NoFramework\Http\Pipeline;
use Lubian\NoFramework\Http\RoutedRequestHandler;
use Lubian\NoFramework\Http\RouteMiddleware;
use Lubian\NoFramework\Repository\CachedMarkdownPageRepo;
use Lubian\NoFramework\Repository\MarkdownPageFilesystem;
use Lubian\NoFramework\Repository\FileSystemMarkdownPageRepo;
use Lubian\NoFramework\Repository\MarkdownPageRepo;
use Lubian\NoFramework\Service\Time\Now;
use Lubian\NoFramework\Service\Time\SystemClockNow;
@ -43,8 +40,8 @@ return [
RoutedRequestHandler::class => fn (InvokerRoutedHandler $h) => $h,
RequestFactory::class => fn (DiactorosRequestFactory $rf) => $rf,
CacheInterface::class => fn (FilesystemAdapter $a) => $a,
MarkdownPageRepo::class => fn (CachedMarkdownPageRepo $r) => $r,
MarkdownParser::class => fn (ParsedownParser $p) => $p,
MarkdownPageRepo::class => fn (FileSystemMarkdownPageRepo $r) => $r,
// Factories
ResponseInterface::class => fn (ResponseFactory $rf) => $rf->createResponse(),
@ -54,7 +51,5 @@ return [
ME::class => fn (MLF $mfl) => new ME(['loader' => $mfl]),
Dispatcher::class => fn () => simpleDispatcher(require __DIR__ . '/routes.php'),
Pipeline::class => fn (PipelineProvider $p) => $p->getPipeline(),
MarkdownPageFilesystem::class => fn (Settings $s) => new MarkdownPageFilesystem($s->pagesPath),
CachedMarkdownPageRepo::class => fn (CacheInterface $c, MarkdownPageFilesystem $r, Settings $s) => new CachedMarkdownPageRepo($c, $r, $s),
EntityManagerInterface::class => fn (DoctrineEm $f) => $f->create(),
FileSystemMarkdownPageRepo::class => fn (Settings $s) => new FileSystemMarkdownPageRepo($s->pagesPath),
];

View file

@ -9,15 +9,4 @@ return new Settings(
templateDir: __DIR__ . '/../templates',
templateExtension: '.html',
pagesPath: __DIR__ . '/../data/pages/',
connection: [
'driver' => 'pdo_sqlite',
'user' => '',
'password' => '',
'path' => __DIR__ . '/../data/db.sqlite',
],
doctrine: [
'devMode' => true,
'metadataDirs' => [__DIR__ . '/../src/Model/'],
'cacheDir' => __DIR__ . '/../data/cache/',
],
);