Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 33 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,50 @@ $ tree -L 5 src

src
β”œβ”€β”€ Application // The application layer of our app
β”‚ └── Post // Inside the application layer all is structured by actions
β”‚ └── Create
β”‚ β”œβ”€β”€ CreatePostCommand.php
β”‚ └── CreatePostUseCase.php
β”‚ └── UseCase // All use cases are structured by commands and queries
β”‚ └── Command
β”‚ └── Post
β”‚ └── Create
β”‚ β”œβ”€β”€ CreatePostCommand.php
β”‚ β”œβ”€β”€ CreatePostUseCase.php
β”‚ └── ...
β”œβ”€β”€ Domain // The domain layer of our app
β”‚ └── Post
β”‚ β”œβ”€β”€ Post.php // The Aggregate of the Module
β”‚ └── Repository
β”‚ └── PostRepositoryInterface.php // The `Interface` of the repository is inside Domain
β”œβ”€β”€ Infrastructure // The layer infrastructure of our app
β”‚ β”œβ”€β”€ Controller
β”‚ └── Persistence
β”‚ └── Post
β”‚ β”œβ”€β”€ Doctrine
β”‚ β”‚ └── Post
β”‚ β”‚ β”œβ”€β”€ PostDoctrineParser.php
β”‚ β”‚ β”œβ”€β”€ PostDoctrineRepository.php // An implementation of the repository
β”‚ β”‚ └── Post.php
β”‚ β”‚ └── Orm
β”‚ β”‚ └── Mapping
β”‚ β”‚ └── Post.orm.yml // YML mapping for direct domain entity mapping
β”‚ β”œβ”€β”€ InFile
β”‚ β”‚ β”œβ”€β”€ FilesystemHandler.php
β”‚ β”‚ └── Post
β”‚ β”‚ β”œβ”€β”€ InFilePostParser.php
β”‚ β”‚ └── InFilePostRepository.php
β”‚ └── InMemory
β”‚ └── Post
β”‚ └── InMemoryPostRepository.php
β”‚ β”‚ β”œβ”€β”€ InFilePostParser.php
β”‚ β”‚ └── InFilePostRepository.php
β”‚ └── Repository
β”‚ β”œβ”€β”€ DoctrinePostRepository.php // An implementation of the repository
β”‚ β”œβ”€β”€ InFilePostRepository.php
β”‚ └── InMemoryPostRepository.php
└── Kernel.php
```

#### πŸ—οΈ Architecture Decisions

This repository demonstrates a **direct domain mapping** approach with Doctrine ORM, where domain entities are mapped directly to the database using YML configuration files, rather than using separate infrastructure entities.

**Key Benefits:**
- βœ… **Simplicity**: Single entity class represents each domain concept
- βœ… **No Duplication**: One source of truth for entity structure
- βœ… **Better Performance**: No conversion overhead between domain and infrastructure entities
- βœ… **Easier Maintenance**: Changes made in one place
- βœ… **Clean Domain**: Pure domain entities without persistence annotations

**πŸ“š Documentation:**
- πŸ“– **[Architecture Decisions](docs/ARCHITECTURE_DECISIONS.md)** - Why we moved from infrastructure entities to direct domain mapping
- πŸ› οΈ **[Practical Examples](docs/EXAMPLES.md)** - Working code examples for value objects, collections, and aggregates
- ❓ **[FAQ: Infrastructure Entities](docs/ISSUE_ANSWER.md)** - Quick answers to common DDD/Doctrine questions

## πŸ€” Contributing

There are some things missing (add some features: exception, ui, improve documentation...), feel free to add this if you
Expand Down
Loading