Answer the question
In order to leave comments, you need to log in
How to put everything in one DB transaction?
There is a controller that receives data via HTTP in the method.
Example
public function __construct($service_1, $service_2, $commandBus )
{
// bind parameters
...
}
public function method(Request $request)
{
$service_1->notifyAdmins(); // persist / flush, saves some data to db
$service_1->notifyCustomerByEmail(); // persist, flush
$commandBus->dispatch(SaveProductToDb $command); // persist, flush
return $data;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question