Giter VIP home page Giter VIP logo

Comments (6)

rubenrubiob avatar rubenrubiob commented on August 16, 2024 1

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:

image

In the case I have more than one framework for persistence, for example, I have it organized like so:

image

Hope it helps!

Where do you put your libraries/frameworks?

from php-ddd.

webdevilopers avatar webdevilopers commented on August 16, 2024 1

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.

rubenrubiob avatar rubenrubiob commented on August 16, 2024

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 within Infrastructure

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.

webdevilopers avatar webdevilopers commented on August 16, 2024

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.

webdevilopers avatar webdevilopers commented on August 16, 2024

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.

rubenrubiob avatar rubenrubiob commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.