userSolver = $this->loadService(UserSolver::class); } public function instanciateOrderStatusHistory(Order $order, User $user, string $status, string $origin): OrderStatusHistory { $orderStatusHistory = new OrderStatusHistory(); $orderStatusHistory->populateOrder($order); $orderStatusHistory->populateUser($user); $orderStatusHistory->status = $status; $orderStatusHistory->origin = $origin; $orderStatusHistory->date = date('Y-m-d H:i:s'); return $orderStatusHistory; } public function createOrderStatusHistory(Order $order, User $user, string $status, string $origin): OrderStatusHistory { $orderStatusHistory = $this->instanciateOrderStatusHistory($order, $user, $status, $origin); $this->saveCreate($orderStatusHistory); return $orderStatusHistory; } }