-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
1,496 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
framework: | ||
messenger: | ||
default_bus: command.bus | ||
buses: | ||
command.bus: ~ | ||
query.bus: ~ | ||
transports: | ||
sync: 'sync://' | ||
routing: | ||
'App\Shared\Application\Query\QueryInterface': 'sync' | ||
'App\Shared\Application\Command\CommandInterface': 'sync' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
sylius_grid: | ||
templates: | ||
action: | ||
delete: 'grid/action/delete.html.twig' | ||
show: 'grid/action/show.html.twig' | ||
update: 'grid/action/update.html.twig' |
3 changes: 3 additions & 0 deletions
3
src/Bundle/test/config/packages/test_with_attributes/sylius_resource.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sylius_resource: | ||
mapping: | ||
paths: ['%kernel.project_dir%/src/Entity'] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Bundle/test/src/BoardGameBlog/Application/Command/CreateBoardGameCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Command; | ||
|
||
use App\BoardGameBlog\Domain\ValueObject\BoardGameName; | ||
use App\Shared\Application\Command\CommandInterface; | ||
|
||
final class CreateBoardGameCommand implements CommandInterface | ||
{ | ||
public function __construct( | ||
public BoardGameName $name, | ||
) { | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Bundle/test/src/BoardGameBlog/Application/Command/CreateBoardGameCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Command; | ||
|
||
use App\BoardGameBlog\Domain\Model\BoardGame; | ||
use App\BoardGameBlog\Domain\Repository\BoardGameRepositoryInterface; | ||
use App\Shared\Application\Command\CommandHandlerInterface; | ||
|
||
final class CreateBoardGameCommandHandler implements CommandHandlerInterface | ||
{ | ||
public function __construct(private BoardGameRepositoryInterface $boardGameRepository) | ||
{ | ||
} | ||
|
||
public function __invoke(CreateBoardGameCommand $command): BoardGame | ||
{ | ||
$boardGame = new BoardGame( | ||
$command->name, | ||
); | ||
|
||
$this->boardGameRepository->save($boardGame); | ||
|
||
return $boardGame; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Bundle/test/src/BoardGameBlog/Application/Command/DeleteBoardGameCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Command; | ||
|
||
use App\BoardGameBlog\Domain\ValueObject\BoardGameId; | ||
use App\Shared\Application\Command\CommandInterface; | ||
|
||
final class DeleteBoardGameCommand implements CommandInterface | ||
{ | ||
public function __construct( | ||
public BoardGameId $id, | ||
) { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Bundle/test/src/BoardGameBlog/Application/Command/DeleteBoardGameCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Command; | ||
|
||
use App\BoardGameBlog\Domain\Repository\BoardGameRepositoryInterface; | ||
use App\Shared\Application\Command\CommandHandlerInterface; | ||
|
||
final class DeleteBoardGameCommandHandler implements CommandHandlerInterface | ||
{ | ||
public function __construct(private BoardGameRepositoryInterface $boardGameRepository) | ||
{ | ||
} | ||
|
||
public function __invoke(DeleteBoardGameCommand $command): void | ||
{ | ||
if (null === $boardGame = $this->boardGameRepository->ofId($command->id)) { | ||
return; | ||
} | ||
|
||
$this->boardGameRepository->remove($boardGame); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Bundle/test/src/BoardGameBlog/Application/Command/UpdateBoardGameCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Command; | ||
|
||
use App\BoardGameBlog\Domain\ValueObject\BoardGameId; | ||
use App\BoardGameBlog\Domain\ValueObject\BoardGameName; | ||
use App\Shared\Application\Command\CommandInterface; | ||
|
||
final class UpdateBoardGameCommand implements CommandInterface | ||
{ | ||
public function __construct( | ||
public BoardGameId $id, | ||
public ?BoardGameName $name = null, | ||
) { | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Bundle/test/src/BoardGameBlog/Application/Command/UpdateBoardGameCommandHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Command; | ||
|
||
use App\BoardGameBlog\Domain\Exception\MissingBoardGameException; | ||
use App\BoardGameBlog\Domain\Model\BoardGame; | ||
use App\BoardGameBlog\Domain\Repository\BoardGameRepositoryInterface; | ||
use App\Shared\Application\Command\CommandHandlerInterface; | ||
|
||
final class UpdateBoardGameCommandHandler implements CommandHandlerInterface | ||
{ | ||
public function __construct(private BoardGameRepositoryInterface $boardGameRepository) | ||
{ | ||
} | ||
|
||
public function __invoke(UpdateBoardGameCommand $command): BoardGame | ||
{ | ||
$boardGame = $this->boardGameRepository->ofId($command->id); | ||
if (null === $boardGame) { | ||
throw new MissingBoardGameException($command->id); | ||
} | ||
|
||
$boardGame->update( | ||
name: $command->name, | ||
); | ||
|
||
$this->boardGameRepository->save($boardGame); | ||
|
||
return $boardGame; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Bundle/test/src/BoardGameBlog/Application/Query/FindBoardGameQuery.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Query; | ||
|
||
use App\BoardGameBlog\Domain\ValueObject\BoardGameId; | ||
use App\Shared\Application\Query\QueryInterface; | ||
|
||
final class FindBoardGameQuery implements QueryInterface | ||
{ | ||
public function __construct( | ||
public BoardGameId $id, | ||
) { | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Bundle/test/src/BoardGameBlog/Application/Query/FindBoardGameQueryHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Application\Query; | ||
|
||
use App\BoardGameBlog\Domain\Model\BoardGame; | ||
use App\BoardGameBlog\Domain\Repository\BoardGameRepositoryInterface; | ||
use App\Shared\Application\Query\QueryHandlerInterface; | ||
|
||
final class FindBoardGameQueryHandler implements QueryHandlerInterface | ||
{ | ||
public function __construct(private BoardGameRepositoryInterface $repository) | ||
{ | ||
} | ||
|
||
public function __invoke(FindBoardGameQuery $query): ?BoardGame | ||
{ | ||
return $this->repository->ofId($query->id); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/Bundle/test/src/BoardGameBlog/Domain/Exception/MissingBoardGameException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\BoardGameBlog\Domain\Exception; | ||
|
||
use App\BoardGameBlog\Domain\ValueObject\BoardGameId; | ||
|
||
final class MissingBoardGameException extends \RuntimeException | ||
{ | ||
public function __construct(BoardGameId $id, int $code = 0, ?\Throwable $previous = null) | ||
{ | ||
parent::__construct(sprintf('Cannot find board game with id %s', (string) $id), $code, $previous); | ||
} | ||
} |
Oops, something went wrong.