Skip to content

Commit d679488

Browse files
Merge pull request #2 from alejandro-yakovlev/feature/DDD
DDD
2 parents 8f7ade8 + 6d31b0d commit d679488

File tree

90 files changed

+2063
-319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+2063
-319
lines changed

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,25 @@ dc_logs:
3030
dc_down:
3131
${DOCKER_COMPOSE} down -v --rmi=all --remove-orphans
3232

33+
dc_restart:
34+
make dc_stop dc_start
35+
3336

3437
##################
3538
# App
3639
##################
3740

3841
app_bash:
3942
${DOCKER_COMPOSE} exec -u www-data php-fpm bash
40-
43+
php:
44+
${DOCKER_COMPOSE} exec -u www-data php-fpm bash
45+
test:
46+
${DOCKER_COMPOSE} exec -u www-data php-fpm bin/phpunit
47+
jwt:
48+
${DOCKER_COMPOSE} exec -u www-data php-fpm bin/console lexik:jwt:generate-keypair
49+
cache:
50+
docker-compose -f ./docker/docker-compose.yml exec -u www-data php-fpm bin/console cache:clear
51+
docker-compose -f ./docker/docker-compose.yml exec -u www-data php-fpm bin/console cache:clear --env=test
4152

4253
##################
4354
# Database
@@ -47,6 +58,9 @@ db_migrate:
4758
${DOCKER_COMPOSE} exec -u www-data php-fpm bin/console doctrine:migrations:migrate --no-interaction
4859
db_diff:
4960
${DOCKER_COMPOSE} exec -u www-data php-fpm bin/console doctrine:migrations:diff --no-interaction
61+
db_drop:
62+
docker-compose -f ./docker/docker-compose.yml exec -u www-data php-fpm bin/console doctrine:schema:drop --force
63+
5064

5165
##################
5266
# Static code analysis
@@ -63,4 +77,4 @@ cs_fix:
6377
${DOCKER_COMPOSE_PHP_FPM_EXEC} vendor/bin/php-cs-fixer fix
6478

6579
cs_fix_diff:
66-
${DOCKER_COMPOSE_PHP_FPM_EXEC} vendor/bin/php-cs-fixer fix --dry-run --diff
80+
${DOCKER_COMPOSE_PHP_FPM_EXEC} vendor/bin/php-cs-fixer fix --dry-run --diff

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@
4444
### Static analysis tool
4545
- [X] [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
4646
- [X] [Deptrac](https://qossmic.github.io/deptrac/)
47-
- [X] [PHPStan](https://github.com/phpstan/phpstan)
47+
- [X] [PHPStan](https://github.com/phpstan/phpstan)
48+
49+
### DDD
50+
- [X] [Strategic & Tactical design]()

config/packages/doctrine.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ doctrine:
1616
dir: '%kernel.project_dir%/src/Users/Infrastructure/Database/ORM'
1717
prefix: 'App\Users\Domain\Entity'
1818
alias: Users
19+
Skills:
20+
is_bundle: false
21+
type: xml
22+
dir: '%kernel.project_dir%/src/Skills/Infrastructure/Database/ORM'
23+
prefix: 'App\Skills\Domain\Entity'
24+
alias: Skills
1925

2026
#when@test:
2127
# doctrine:

config/packages/messenger.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ framework:
66
middleware:
77
- doctrine_transaction
88
query.bus:
9+
event.bus:
10+
default_middleware: allow_no_handlers
911

1012
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
1113
# failure_transport: failed

config/services.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ services:
2525
tags:
2626
- { name: messenger.message_handler, bus: query.bus }
2727

28+
App\Shared\Domain\Event\EventHandlerInterface:
29+
tags:
30+
- { name: messenger.message_handler, bus: event.bus }
31+
2832
App\Users\Infrastructure\Controller\:
2933
resource: '../src/Users/Infrastructure/Controller/'
30-
tags: [ 'controller.service_arguments' ]
34+
tags: [ 'controller.service_arguments' ]
35+
36+
37+
App\Shared\Infrastructure\Doctrine\DomainEventSubscriber:
38+
tags: [ { name: 'doctrine.event_subscriber' } ]
39+
arguments:
40+
$containerBag: '@service_container'

config/services_test.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,17 @@ services:
1111
public: true
1212

1313
App\Shared\Infrastructure\Bus\QueryBus:
14+
public: true
15+
16+
App\Shared\Infrastructure\Bus\EventBus:
17+
public: true
18+
19+
App\Skills\Domain\Factory\:
20+
resource: '../src/Skills/Domain/Factory'
21+
public: true
22+
App\Skills\Domain\Specification\:
23+
resource: '../src/Skills/Domain/Specification'
24+
public: true
25+
App\Skills\Domain\Repository\:
26+
resource: '../src/Skills/Domain/Repository'
1427
public: true

docker/php-fpm/xdebug.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ xdebug.mode=debug
22
xdebug.discover_client_host=1
33
xdebug.start_with_request=yes
44
xdebug.idekey=PHPSTORM
5+
xdebug.client_host=host.docker.internal
56
xdebug.log_level=0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace App\Company\Domain\Entity\Company;
4+
5+
use App\Shared\Domain\ValueObject\GlobalUserId;
6+
7+
class Company
8+
{
9+
private string $id;
10+
11+
private GlobalUserId $owner;
12+
13+
private ContactPerson $contactPerson;
14+
15+
private string $name;
16+
17+
public function __construct(GlobalUserId $owner, ContactPerson $contactPerson, string $name)
18+
{
19+
$this->owner = $owner;
20+
$this->contactPerson = $contactPerson;
21+
$this->name = $name;
22+
}
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace App\Company\Domain\Entity\Company;
4+
5+
use JetBrains\PhpStorm\Immutable;
6+
7+
#[Immutable]
8+
class ContactPerson
9+
{
10+
public function __construct(
11+
private readonly string $name,
12+
private readonly string $phoneNumber
13+
) {
14+
}
15+
16+
public function getName(): string
17+
{
18+
return $this->name;
19+
}
20+
21+
public function getPhoneNumber(): string
22+
{
23+
return $this->phoneNumber;
24+
}
25+
}

src/Recipes/Application/DTO/RecipeDTO.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)