Skip to content

Commit

Permalink
chore: change directory structure, move bc on top
Browse files Browse the repository at this point in the history
  • Loading branch information
mtarld committed Sep 3, 2022
1 parent 90df4ad commit 66b4e12
Show file tree
Hide file tree
Showing 60 changed files with 167 additions and 172 deletions.
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env php
<?php

use App\Infrastructure\Shared\Symfony\Kernel;
use App\Shared\Infrastructure\Symfony\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
Expand Down
2 changes: 1 addition & 1 deletion config/packages/api_platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$containerConfigurator->extension('api_platform', [
'mapping' => [
'paths' => [
'%kernel.project_dir%/src/Infrastructure/BookStore/ApiPlatform/Resource/',
'%kernel.project_dir%/src/BookStore/Infrastructure/ApiPlatform/Resource/',
],
],
'patch_formats' => [
Expand Down
4 changes: 2 additions & 2 deletions config/packages/doctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
'BookStore' => [
'is_bundle' => false,
'type' => 'attribute',
'dir' => '%kernel.project_dir%/src/Domain/BookStore/Model',
'prefix' => 'App\Domain\BookStore\Model',
'dir' => '%kernel.project_dir%/src/BookStore/Domain/Model',
'prefix' => 'App\BookStore\Domain\Model',
],
],
],
Expand Down
4 changes: 2 additions & 2 deletions config/packages/messenger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use App\Application\Shared\Command\CommandInterface;
use App\Application\Shared\Query\QueryInterface;
use App\Shared\Application\Command\CommandInterface;
use App\Shared\Application\Query\QueryInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand Down
19 changes: 8 additions & 11 deletions config/services/book_store.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\Infrastructure\BookStore\ApiPlatform\State\Processor\AnonymizeBooksProcessor;
use App\Infrastructure\BookStore\ApiPlatform\State\Processor\BookCrudProcessor;
use App\Infrastructure\BookStore\ApiPlatform\State\Provider\BookCrudProvider;
use App\Infrastructure\BookStore\ApiPlatform\State\Processor\DiscountBookProcessor;
use App\Infrastructure\BookStore\ApiPlatform\State\Provider\CheapestBooksProvider;
use App\Infrastructure\BookStore\Doctrine\DoctrineBookRepository;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\BookStore\Infrastructure\ApiPlatform\State\Processor\AnonymizeBooksProcessor;
use App\BookStore\Infrastructure\ApiPlatform\State\Processor\BookCrudProcessor;
use App\BookStore\Infrastructure\ApiPlatform\State\Processor\DiscountBookProcessor;
use App\BookStore\Infrastructure\ApiPlatform\State\Provider\BookCrudProvider;
use App\BookStore\Infrastructure\ApiPlatform\State\Provider\CheapestBooksProvider;
use App\BookStore\Infrastructure\Doctrine\DoctrineBookRepository;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand All @@ -18,9 +18,7 @@
->autowire()
->autoconfigure();

$services->load('App\\Domain\\BookStore\\', __DIR__.'/../../src/Domain/BookStore');
$services->load('App\\Application\\BookStore\\', __DIR__.'/../../src/Application/BookStore');
$services->load('App\\Infrastructure\\BookStore\\', __DIR__.'/../../src/Infrastructure/BookStore');
$services->load('App\\BookStore\\', __DIR__.'/../../src/BookStore');

// providers
$services->set(CheapestBooksProvider::class)
Expand Down Expand Up @@ -48,4 +46,3 @@
$services->set(BookRepositoryInterface::class)
->class(DoctrineBookRepository::class);
};

8 changes: 2 additions & 6 deletions config/services/shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

$services->defaults()
->autowire()
->autoconfigure();

$services->load('App\\Domain\\Shared\\', __DIR__.'/../../src/Domain/Shared');
$services->load('App\\Application\\Shared\\', __DIR__.'/../../src/Application/Shared');
$services->load('App\\Infrastructure\\Shared\\', __DIR__.'/../../src/Infrastructure/Shared')
->exclude([__DIR__.'/../../src/Infrastructure/Shared/Kernel.php']);
$services->load('App\\Shared\\', __DIR__.'/../../src/Shared')
->exclude([__DIR__.'/../../src/Shared/Infrastructure/Kernel.php']);
};
4 changes: 2 additions & 2 deletions config/services/test/book_store.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

declare(strict_types=1);

use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\Infrastructure\BookStore\InMemory\InMemoryBookRepository;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\BookStore\Infrastructure\InMemory\InMemoryBookRepository;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand Down
2 changes: 1 addition & 1 deletion docs/infrastructure/query_providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ As there is one provider per query, each provider must be scoped to handle its r
This could be done like the following:
```php
use App\Application\[BoundedContext]\Query\MyQuery;
use App\Infrastructure\Shared\ApiPlatform\Metadata\QueryOperation;
use App\Shared\Infrastructure\ApiPlatform\Metadata\QueryOperation;

public function supports(string $resourceClass, array $identifiers = [], ?string $operationName = null, array $context = []): bool
{
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="KERNEL_CLASS" value="App\Infrastructure\Shared\Symfony\Kernel" />
<server name="KERNEL_CLASS" value="App\Shared\Infrastructure\Symfony\Kernel" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use App\Infrastructure\Shared\Symfony\Kernel;
use App\Shared\Infrastructure\Symfony\Kernel;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandInterface;
use App\Shared\Application\Command\CommandInterface;

final class AnonymizeBooksCommand implements CommandInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandHandlerInterface;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Command\CommandHandlerInterface;

final class AnonymizeBooksCommandHandler implements CommandHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandInterface;
use App\Shared\Application\Command\CommandInterface;
use Webmozart\Assert\Assert;

final class CreateBookCommand implements CommandInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandHandlerInterface;
use App\Domain\BookStore\Model\Book;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Model\Book;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Command\CommandHandlerInterface;

final class CreateBookCommandHandler implements CommandHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandInterface;
use App\Shared\Application\Command\CommandInterface;
use Symfony\Component\Uid\Uuid;

final class DeleteBookCommand implements CommandInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandHandlerInterface;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Command\CommandHandlerInterface;

final class DeleteBookCommandHandler implements CommandHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandInterface;
use App\Shared\Application\Command\CommandInterface;
use Symfony\Component\Uid\Uuid;
use Webmozart\Assert\Assert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandHandlerInterface;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Command\CommandHandlerInterface;

final class DiscountBookCommandHandler implements CommandHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandInterface;
use App\Shared\Application\Command\CommandInterface;
use Symfony\Component\Uid\Uuid;
use Webmozart\Assert\Assert;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace App\Application\BookStore\Command;
namespace App\BookStore\Application\Command;

use App\Application\Shared\Command\CommandHandlerInterface;
use App\Domain\BookStore\Model\Book;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Model\Book;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Command\CommandHandlerInterface;

final class UpdateBookCommandHandler implements CommandHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Query;
namespace App\BookStore\Application\Query;

use App\Application\Shared\Query\QueryInterface;
use App\Shared\Application\Query\QueryInterface;
use Symfony\Component\Uid\Uuid;

final class FindBookQuery implements QueryInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace App\Application\BookStore\Query;
namespace App\BookStore\Application\Query;

use App\Application\Shared\Query\QueryHandlerInterface;
use App\Domain\BookStore\Model\Book;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Model\Book;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Query\QueryHandlerInterface;

final class FindBookQueryHandler implements QueryHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Query;
namespace App\BookStore\Application\Query;

use App\Application\Shared\Query\QueryInterface;
use App\Shared\Application\Query\QueryInterface;

final class FindBooksQuery implements QueryInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Application\BookStore\Query;
namespace App\BookStore\Application\Query;

use App\Application\Shared\Query\QueryHandlerInterface;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Query\QueryHandlerInterface;

final class FindBooksQueryHandler implements QueryHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace App\Application\BookStore\Query;
namespace App\BookStore\Application\Query;

use App\Application\Shared\Query\QueryInterface;
use App\Shared\Application\Query\QueryInterface;

final class FindCheapestBooksQuery implements QueryInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Application\BookStore\Query;
namespace App\BookStore\Application\Query;

use App\Application\Shared\Query\QueryHandlerInterface;
use App\Domain\BookStore\Repository\BookRepositoryInterface;
use App\BookStore\Domain\Repository\BookRepositoryInterface;
use App\Shared\Application\Query\QueryHandlerInterface;

final class FindCheapestBooksQueryHandler implements QueryHandlerInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Domain\BookStore\Model;
namespace App\BookStore\Domain\Model;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace App\Domain\BookStore\Repository;
namespace App\BookStore\Domain\Repository;

use App\Domain\BookStore\Model\Book;
use App\Domain\Shared\Repository\RepositoryInterface;
use App\BookStore\Domain\Model\Book;
use App\Shared\Domain\Repository\RepositoryInterface;
use Symfony\Component\Uid\Uuid;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\BookStore\ApiPlatform\OpenApi;
namespace App\BookStore\Infrastructure\ApiPlatform\OpenApi;

use ApiPlatform\Core\Api\FilterInterface;
use Symfony\Component\PropertyInfo\Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\BookStore\ApiPlatform\Payload;
namespace App\BookStore\Infrastructure\ApiPlatform\Payload;

use Symfony\Component\Validator\Constraints as Assert;

Expand Down
Loading

0 comments on commit 66b4e12

Please sign in to comment.