josecelano / ddd-laravel-sample

A Laravel DDD sample application using CQRS and persisting entities serialized without ORM
276 stars 59 forks source link

where is called src/Mfa/Application/Command/Handler/UpdateOrCreateApplianceCommandHandler.php ? #16

Open Cepairda opened 3 years ago

Cepairda commented 3 years ago

I took a close look at the code. And I did not find the place where this section of the code is called. Where does the call take place?

josecelano commented 3 years ago

Hi @Cepairda I'm using a command bus package: https://github.com/jildertmiedema/laravel-tactician

That means you can create a command and a command handler which is the service that handles the command. That a simple package that follows some conventions in order to map the command with its handler.

These are the 2 points where the command is dispatched:

https://github.com/josecelano/ddd-laravel-sample/blob/f4b905d8cd9c2cbc6717794a462ebc749bf599cb/app/Services/WishList/DishwashersCrawler.php#L77

https://github.com/josecelano/ddd-laravel-sample/blob/f4b905d8cd9c2cbc6717794a462ebc749bf599cb/app/Services/WishList/SmallAppliancesCrawler.php#L77

As you can see the method is injected in the class with a trait:

https://github.com/josecelano/ddd-laravel-sample/blob/f4b905d8cd9c2cbc6717794a462ebc749bf599cb/app/Services/WishList/DishwashersCrawler.php#L16

given by that package.

You have the documentation about Tactician here: https://tactician.thephpleague.com/

Be aware that this is an old project I have not had time to maintain. I was importing appliances data from a site that does not exist anymore: https://www.appliancesdelivered.ie/ I should change the crawler part to get data from another web.

I did another example using SYmphony: https://github.com/josecelano/ddd-symfony-sample but it's also very old although the principles still apply. But they have a lot of deprecated packages and I haven't tested them for a long time.

If you are looking for samples about how to apply DDD with PHP this is a good starting point: https://github.com/dddinphp I got the basic ideas from their sample: https://github.com/dddinphp/last-wishes