creditHistorySolver = $this->loadService(CreditHistorySolver::class); $this->userProducerBuilder = $this->loadService(UserProducerBuilder::class); } public function instanciate(): CreditHistory { $creditHistory = new CreditHistory(); return $creditHistory; } public function save(CreditHistory $creditHistory): bool { if ($creditHistory->getAmount() > -0.01 && $creditHistory->getAmount() < 0.01) { return false; } // Initialisation du commentaire avant sauvegarde $creditHistory->setComment($creditHistory->getComment() . $this->creditHistorySolver->getStrComment($creditHistory)); $creditHistory->save(); // Mise à jour du crédit au niveau de UserProducer $this->userProducerBuilder->updateCredit($creditHistory); return true; } }