|
|
|
|
|
|
|
|
|
|
|
|
|
|
use common\logic\BaseService; |
|
|
use common\logic\BaseService; |
|
|
use common\logic\BuilderInterface; |
|
|
use common\logic\BuilderInterface; |
|
|
|
|
|
use common\services\UserProducer\UserProducerBuilder; |
|
|
|
|
|
|
|
|
class CreditHistoryBuilder extends BaseService implements BuilderInterface |
|
|
class CreditHistoryBuilder extends BaseService implements BuilderInterface |
|
|
{ |
|
|
{ |
|
|
protected CreditHistorySolver $creditHistorySolver; |
|
|
protected CreditHistorySolver $creditHistorySolver; |
|
|
|
|
|
protected UserProducerBuilder $userProducerBuilder; |
|
|
|
|
|
|
|
|
public function __construct() |
|
|
public function __construct() |
|
|
{ |
|
|
{ |
|
|
$this->creditHistorySolver = $this->loadService(CreditHistorySolver::class); |
|
|
$this->creditHistorySolver = $this->loadService(CreditHistorySolver::class); |
|
|
|
|
|
$this->userProducerBuilder = $this->loadService(UserProducerBuilder::class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function save(CreditHistoryModel $creditHistory): bool |
|
|
public function save(CreditHistoryModel $creditHistory): bool |
|
|
|
|
|
|
|
|
$creditHistory->save(); |
|
|
$creditHistory->save(); |
|
|
|
|
|
|
|
|
// Mise à jour du crédit au niveau de UserProducer |
|
|
// Mise à jour du crédit au niveau de UserProducer |
|
|
\Yii::$app->logic->getUserProducerContainer()->getService()->updateCredit($creditHistory); |
|
|
|
|
|
|
|
|
$this->userProducerBuilder->updateCredit($creditHistory); |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |