|
|
@@ -35,10 +35,7 @@ class ProductDistributionBuilder extends AbstractBuilder |
|
|
|
public function createProductDistribution(Distribution $distribution, Product $product): ProductDistribution |
|
|
|
{ |
|
|
|
$productDistribution = $this->instanciateProductDistribution($distribution, $product); |
|
|
|
|
|
|
|
$this->initActive($productDistribution); |
|
|
|
$this->initQuantityMax($productDistribution); |
|
|
|
|
|
|
|
$this->initProductDistribution($productDistribution); |
|
|
|
$this->saveCreate($productDistribution); |
|
|
|
|
|
|
|
return $productDistribution; |
|
|
@@ -49,6 +46,21 @@ class ProductDistributionBuilder extends AbstractBuilder |
|
|
|
return $this->productDistributionRepository->findOneProductDistribution($distribution, $product) |
|
|
|
?? $this->createProductDistribution($distribution, $product); |
|
|
|
} |
|
|
|
public function updateProductDistribution(ProductDistribution $productDistribution): ProductDistribution |
|
|
|
{ |
|
|
|
$this->initProductDistribution($productDistribution); |
|
|
|
$this->saveUpdate($productDistribution); |
|
|
|
|
|
|
|
return $productDistribution; |
|
|
|
} |
|
|
|
|
|
|
|
public function initProductDistribution(ProductDistribution $productDistribution): ProductDistribution |
|
|
|
{ |
|
|
|
$this->initActive($productDistribution); |
|
|
|
$this->initQuantityMax($productDistribution); |
|
|
|
|
|
|
|
return $productDistribution; |
|
|
|
} |
|
|
|
|
|
|
|
public function initActive(ProductDistribution $productDistribution): ProductDistribution |
|
|
|
{ |