Model behaviour

Igor Budasov
WebDevOps
Published in
1 min readOct 15, 2018

Consider a method:

public function doSomethingWithOrder(Order $order): Order
{
// ...
}

It takes an Order and returns an Order. In my opinion this method can be moved Order model itself.

What’s the exception for doing that? If in this method also used some application service:

public function doSomethingWithOrder(Order $order): Order
{
// ...

$this->applicationService->doSomethingElse();

// ...
}

Why? It will require injecting applicationService to the Order . I’d use Application Service pattern for that

--

--

Igor Budasov
WebDevOps

A traveller. A drinker. A photographer. A blogger. An engineer.