Comments (5)
hey @zvuki, the java version of the cargo sample also manages transaction on application level, see here: https://github.com/citerus/dddsample-core/blob/master/src/main/java/se/citerus/dddsample/application/impl/BookingServiceImpl.java#L33
The reason for this is that a bounded context forms the transaction boundary. Every action triggered in the model should be wrapped in a transaction. Sure you can hide the transaction in the repository, but then you need to be very very careful as really only one AR can be modified in a safe way within a single request. This is recommended but not always possible. When working with doctrine and associations between entities you might modify more than one in a request. When managing the transaction in an application service that owns the use case triggered by the request you can make sure that either all changes are committed or rolled back.
from php-ddd-cargo-sample.
This way you have to mock TransactionManager in unit tests, which is not the end of the world of course, my gut feeling it doesn't belong there. Anyway, I completely understand the reasoning.
Thank you for the answer!
from php-ddd-cargo-sample.
You are right. a TransactionManager interface would be better and then a DoctrineTransactionManager implementation. This way the transaction manager can easily be mocked. Let's keep the question open until this is changed.
from php-ddd-cargo-sample.
Someone interested in providing a TransactionManager
interface? Drop me a note here!
from php-ddd-cargo-sample.
Closed by #35
from php-ddd-cargo-sample.
Related Issues (20)
- Exclude Voyage from current version of the system HOT 1
- Use Case: Create Cargo with RouteSpecification HOT 1
- Use Case: Get a list of possible Itineraries for a RouteSpecification HOT 1
- Use Case: Assign Cargo to Itinerary HOT 1
- PHP Version HOT 1
- Nginx configuration. HOT 2
- Fix travis-ci build problem HOT 2
- Running sample on PHP 5.6 HOT 9
- could not find the url: https://github.com/prooph/php-ddd-cargo-sample HOT 2
- http://0.0.0.0:8080/#booking booking page error HOT 3
- HTTP is User Interface HOT 3
- Container factories are part of infrastructure? HOT 1
- 500 internal server error HOT 1
- Upgrade to expressive 2.0 and PSR-15 middlewares HOT 6
- Bump PHP version to 7.1 HOT 3
- Outdated Annotated Project Sctructure
- Upgrade to Expressive 3.0 HOT 1
- Confusion between DTO and Value Object HOT 2
- DDD with Symfony 4 HOT 5
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-cargo-sample.