Comments (6)
It should be doable within blog post, but I do not have a blog where to post it 😅
I do not know what you mean exactly by where I put Symfony. Usually, Symfony is for the Controllers or CLI Commands, that live in the Ui folder, that it is Infrastructure.
In my infrastructure layer I have implementations for my Domain interfaces, and they belong in some higher namespace with the functionallity and the name of the library/framework. Below there is a screenshot of a folder structure of one of my projects, to make it clearer:
In the case I have more than one framework for persistence, for example, I have it organized like so:
Hope it helps!
Where do you put your libraries/frameworks?
from php-ddd.
Sure @rubenrubiob , maybe you could just open up a new issue "Where to put read models" on this repo and add your examples. We can discuss some solutions then. Looking forward to that.
from php-ddd.
I think that, for removing the App
namespace, you have to change composer psr-4 autoloader, too.
I would rather skip the App
name if it is something that does not make sense for your applications. My applications usually have the namespaces:
{BoundedContext}\Application
{BoundedContext}\Domain
{BoundedContext}\Infrastructure
{BoundedContext}\Ui
(though it could be withinInfrastructure
Is it so tedious to remove the App
namespace? Perhaps it is if you create many applications.
Maybe it is possible to automate it somehow? I am thinking about a script, but maybe it is possible to create a Symfony recipe that can be installed?
from php-ddd.
A recipe or a short blog where to move and delete what would indeed be nice.
Where do you put Symfony in your example -> Infrastructure\Symfony (or Framework or similar?)
from php-ddd.
Similar to your approach. But we currently also have a Infrastructure/Symfony
directory.
In addition to that a Presentation
layer which is equal to your "UI / UserInterface
layer.
But it also holds an Model
namespace that holds all our read models as objects.
This helps us communicating our read models and ensuring the projections were correctly applied since a lot of invariants for WRITE processes will rely on a the valid read model.
from php-ddd.
It sounds interesting.
How have you implemented those read models? What do they represent? Are they for mapping input prior to call your application services?
I do not apply fully CQRS, but I separate my write and read models. For instance, in a project I have a category tree of 3 levels, and I persist them all independently, because the business requires so. But when I query them, I perform a query that unifies the 3 levels into a read model. That read model lives within the Domain layer.
What I have in my UI layer are objects that map a request, from a form or an API, into an object, that is validated using Symfony validator within a controller resolver. The same object tells me if has passed the validation and, if so, I call my command bus getting the parameters from that object.
I do not know if I am making myself clear, but I can show you a minimal example, if you want :)
from php-ddd.
Related Issues (20)
- Repositories inside or outside Domain Services HOT 1
- Event Enriching and external changes to read-model data
- When, where and how to create Summary Events HOT 3
- Passing read models (value objects representing state) / domain service to aggregate methods HOT 6
- Unit testing value objects with internal datetime calculation HOT 14
- How to test application service command handlers dealing with read models? HOT 12
- Process Manager example with Symfony Messenger Command / Event Bus and ProophOS HOT 5
- Batch / Bulk operations handling multiple event-sourced aggregate roots HOT 3
- How to use factory methods on aggregates in CQRS - WRITE vs. READ model HOT 1
- How to keep read-models up-to-date when a name property was externally changed?
- How to upcast events with Prooph HOT 1
- Are CQRS commands part of the domain model? HOT 13
- Populate Projection with multiple tables HOT 2
- Where to call or pass a domain service? HOT 16
- How to implement the Equatable interface / Equals or SameValueAs method in value objects
- Domain Event Publisher for Doctrine Entities HOT 1
- Event Sourcing vs. Event-Driven Architecture (EDA)
- The repository pattern HOT 4
- Properties on Domain Events HOT 3
- PHP Command DTO with Symfony Constraints equivalent in Angular Forms HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-ddd.