Ramon's avatar

Update on DDD pattern

Hello, I'm trying to follow this "new" pattern, but I stopped in a question. In DDD, we use a command/command handler to update an entity? I guess in Larabook's serie Jeff's using commander only in register/post methods.

0 likes
2 replies
Ramon's avatar

For example, when I'm updating one job, the update method calls a UpdateJobCommand/Command Handler and receive an entity? Because when I'm creating I could diagram like this:

Controller (request)->Command(response)->CommandHandler(receive/request)->Model(response)-> CommandHandler(receives/request)->Repo(save);

Now in update should I do something like this?

Controller (request)->Command(response)->CommandHandler(receive/request)->Repo(update);

Simplifying there's something that I need to do in my Eloquent's class? Similar to "return new static(compact('name', 'icon'));" on add's method? Or can I handle the update just using my Repo?

Please or to participate in this conversation.