Skip to content

Commit 3e978e0

Browse files
author
olaru
committed
start dotkernel.com cs fix
1 parent 9c6a362 commit 3e978e0

15 files changed

Lines changed: 52 additions & 48 deletions

‎src/App/src/ConfigProvider.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Light\App\Factory\GetIndexViewHandlerFactory;
1414
use Light\App\Handler\GetIndexViewHandler;
1515
use Mezzio\Application;
16+
use Ramsey\Uuid\Doctrine\UuidType;
1617
use Roave\PsrContainerDoctrine\EntityManagerFactory;
1718
use Symfony\Component\Cache\Adapter\AdapterInterface;
1819

@@ -179,6 +180,9 @@ private function getDoctrineConfig(): array
179180
'all_or_nothing' => true,
180181
'check_database_platform' => true,
181182
],
183+
'types' => [
184+
UuidType::NAME => UuidType::class,
185+
],
182186
];
183187
}
184188
}

‎src/App/templates/layout/default.html.twig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<div class="dropdown-menu" aria-labelledby="pageDropdown">
4747
<a class="dropdown-item" href="{{ url('page::about') }}">About Us</a>
4848
<a class="dropdown-item" href="{{ url('page::who-we-are') }}">Who We Are</a>
49-
<a class="dropdown-item" href="{{ url('page::posts') }}">Posts</a>
49+
<a class="dropdown-item" href="{{ url('page::blog') }}">Posts</a>
5050
<a class="dropdown-item" href="{{ url('page::categories') }}">Categories</a>
5151
</div>
5252
</li>

‎src/Blog/src/ConfigProvider.php‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
namespace Light\Blog;
66

77
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
8-
use Light\App\Factory\Articles\ArticleHandlerFactory;
9-
use Light\App\Factory\Articles\ArticleRepositoryFactory;
10-
use Light\App\Factory\Categories\CategoryHandlerFactory;
11-
use Light\App\Factory\Categories\CategoryRepositoryFactory;
12-
use Light\App\Factory\Posts\PostHandlerFactory;
13-
use Light\Blog\Handler\GetArticlesHandler;
14-
use Light\Blog\Handler\GetCategoriesHandler;
15-
use Light\Blog\Handler\GetPostHandler;
8+
use Light\Blog\Factory\Articles\ArticleCollectionHandlerFactory;
9+
use Light\Blog\Factory\Articles\ArticleCollectionRepositoryFactory;
10+
use Light\Blog\Factory\Articles\ArticleResourceHandlerFactory;
11+
use Light\Blog\Factory\Categories\CategoryCollectionHandlerFactory;
12+
use Light\Blog\Factory\Categories\CategoryCollectionRepositoryFactory;
13+
use Light\Blog\Handler\GetArticleCollectionHandler;
14+
use Light\Blog\Handler\GetArticleResourceHandler;
15+
use Light\Blog\Handler\GetCategoryCollectionHandler;
1616
use Light\Blog\Repository\ArticleRepository;
1717
use Light\Blog\Repository\CategoryRepository;
1818
use Mezzio\Application;
@@ -49,11 +49,11 @@ private function getDependencies(): array
4949
],
5050
],
5151
'factories' => [
52-
GetCategoriesHandler::class => CategoryHandlerFactory::class,
53-
CategoryRepository::class => CategoryRepositoryFactory::class,
54-
GetArticlesHandler::class => ArticleHandlerFactory::class,
55-
ArticleRepository::class => ArticleRepositoryFactory::class,
56-
GetPostHandler::class => PostHandlerFactory::class,
52+
GetCategoryCollectionHandler::class => CategoryCollectionHandlerFactory::class,
53+
CategoryRepository::class => CategoryCollectionRepositoryFactory::class,
54+
GetArticleCollectionHandler::class => ArticleCollectionHandlerFactory::class,
55+
ArticleRepository::class => ArticleCollectionRepositoryFactory::class,
56+
GetArticleResourceHandler::class => ArticleResourceHandlerFactory::class,
5757
],
5858
];
5959
}

src/App/src/Factory/Articles/ArticleHandlerFactory.php renamed to src/Blog/src/Factory/Articles/ArticleCollectionHandlerFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace Light\App\Factory\Articles;
5+
namespace Light\Blog\Factory\Articles;
66

7-
use Light\Blog\Handler\GetArticlesHandler;
7+
use Light\Blog\Handler\GetArticleCollectionHandler;
88
use Light\Blog\Repository\ArticleRepository;
99
use Light\Blog\Repository\CategoryRepository;
1010
use Mezzio\Template\TemplateRendererInterface;
@@ -14,13 +14,13 @@
1414

1515
use function assert;
1616

17-
class ArticleHandlerFactory
17+
class ArticleCollectionHandlerFactory
1818
{
1919
/**
2020
* @throws ContainerExceptionInterface
2121
* @throws NotFoundExceptionInterface
2222
*/
23-
public function __invoke(ContainerInterface $container, string $requestedName): GetArticlesHandler
23+
public function __invoke(ContainerInterface $container, string $requestedName): GetArticleCollectionHandler
2424
{
2525
$repository = $container->get(ArticleRepository::class);
2626
$categoryRepository = $container->get(CategoryRepository::class);
@@ -29,6 +29,6 @@ public function __invoke(ContainerInterface $container, string $requestedName):
2929
assert($repository instanceof ArticleRepository);
3030
assert($template instanceof TemplateRendererInterface);
3131

32-
return new GetArticlesHandler($template, $repository, $categoryRepository);
32+
return new GetArticleCollectionHandler($template, $repository, $categoryRepository);
3333
}
3434
}

src/App/src/Factory/Articles/ArticleRepositoryFactory.php renamed to src/Blog/src/Factory/Articles/ArticleCollectionRepositoryFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Light\App\Factory\Articles;
5+
namespace Light\Blog\Factory\Articles;
66

77
use Doctrine\ORM\EntityManager;
88
use Light\Blog\Entity\Article;
@@ -13,7 +13,7 @@
1313

1414
use function assert;
1515

16-
class ArticleRepositoryFactory
16+
class ArticleCollectionRepositoryFactory
1717
{
1818
/**
1919
* @throws ContainerExceptionInterface

src/App/src/Factory/Posts/PostHandlerFactory.php renamed to src/Blog/src/Factory/Articles/ArticleResourceHandlerFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace Light\App\Factory\Posts;
5+
namespace Light\Blog\Factory\Articles;
66

7-
use Light\Blog\Handler\GetPostHandler;
7+
use Light\Blog\Handler\GetArticleResourceHandler;
88
use Light\Blog\Repository\ArticleRepository;
99
use Mezzio\Template\TemplateRendererInterface;
1010
use Psr\Container\ContainerExceptionInterface;
@@ -13,20 +13,20 @@
1313

1414
use function assert;
1515

16-
class PostHandlerFactory
16+
class ArticleResourceHandlerFactory
1717
{
1818
/**
1919
* @throws ContainerExceptionInterface
2020
* @throws NotFoundExceptionInterface
2121
*/
22-
public function __invoke(ContainerInterface $container, string $requestedName): GetPostHandler
22+
public function __invoke(ContainerInterface $container, string $requestedName): GetArticleResourceHandler
2323
{
2424
$repository = $container->get(ArticleRepository::class);
2525
$template = $container->get(TemplateRendererInterface::class);
2626

2727
assert($repository instanceof ArticleRepository);
2828
assert($template instanceof TemplateRendererInterface);
2929

30-
return new GetPostHandler($template, $repository);
30+
return new GetArticleResourceHandler($template, $repository);
3131
}
3232
}

src/App/src/Factory/Categories/CategoryHandlerFactory.php renamed to src/Blog/src/Factory/Categories/CategoryCollectionHandlerFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace Light\App\Factory\Categories;
5+
namespace Light\Blog\Factory\Categories;
66

7-
use Light\Blog\Handler\GetCategoriesHandler;
7+
use Light\Blog\Handler\GetCategoryCollectionHandler;
88
use Light\Blog\Repository\CategoryRepository;
99
use Mezzio\Template\TemplateRendererInterface;
1010
use Psr\Container\ContainerExceptionInterface;
@@ -13,20 +13,20 @@
1313

1414
use function assert;
1515

16-
class CategoryHandlerFactory
16+
class CategoryCollectionHandlerFactory
1717
{
1818
/**
1919
* @throws ContainerExceptionInterface
2020
* @throws NotFoundExceptionInterface
2121
*/
22-
public function __invoke(ContainerInterface $container, string $requestedName): GetCategoriesHandler
22+
public function __invoke(ContainerInterface $container, string $requestedName): GetCategoryCollectionHandler
2323
{
2424
$repository = $container->get(CategoryRepository::class);
2525
$template = $container->get(TemplateRendererInterface::class);
2626

2727
assert($repository instanceof CategoryRepository);
2828
assert($template instanceof TemplateRendererInterface);
2929

30-
return new GetCategoriesHandler($template, $repository);
30+
return new GetCategoryCollectionHandler($template, $repository);
3131
}
3232
}

src/App/src/Factory/Categories/CategoryRepositoryFactory.php renamed to src/Blog/src/Factory/Categories/CategoryCollectionRepositoryFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Light\App\Factory\Categories;
5+
namespace Light\Blog\Factory\Categories;
66

77
use Doctrine\ORM\EntityManager;
88
use Light\Blog\Entity\Category;
@@ -13,7 +13,7 @@
1313

1414
use function assert;
1515

16-
class CategoryRepositoryFactory
16+
class CategoryCollectionRepositoryFactory
1717
{
1818
/**
1919
* @throws ContainerExceptionInterface

src/Blog/src/Handler/GetArticlesHandler.php renamed to src/Blog/src/Handler/GetArticleCollectionHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Psr\Http\Message\ServerRequestInterface;
1313
use Psr\Http\Server\RequestHandlerInterface;
1414

15-
class GetArticlesHandler implements RequestHandlerInterface
15+
class GetArticleCollectionHandler implements RequestHandlerInterface
1616
{
1717
public function __construct(
1818
protected TemplateRendererInterface $template,
@@ -26,7 +26,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
2626
$articles = $this->articleRepository->getArticles();
2727
$categories = $this->categoryRepository->getCategories();
2828
return new HtmlResponse(
29-
$this->template->render('page::posts', [
29+
$this->template->render('page::blog', [
3030
'articles' => $articles,
3131
'categories' => $categories,
3232
])

src/Blog/src/Handler/GetPostHandler.php renamed to src/Blog/src/Handler/GetArticleResourceHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Psr\Http\Message\ServerRequestInterface;
1212
use Psr\Http\Server\RequestHandlerInterface;
1313

14-
class GetPostHandler implements RequestHandlerInterface
14+
class GetArticleResourceHandler implements RequestHandlerInterface
1515
{
1616
public function __construct(
1717
private readonly TemplateRendererInterface $template,
@@ -22,9 +22,9 @@ public function __construct(
2222
public function handle(ServerRequestInterface $request): ResponseInterface
2323
{
2424
$slug = $request->getAttribute('slug');
25-
$article = $this->articleRepository->getPostBySlug($slug);
25+
$article = $this->articleRepository->getArticleResource($slug);
2626
return new HtmlResponse(
27-
$this->template->render('page::posts/' . $slug, [
27+
$this->template->render('page::blog-resource/' . $slug, [
2828
'article' => $article,
2929
])
3030
);

0 commit comments

Comments
 (0)