You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
934B

  1. <?php
  2. namespace common\logic\Product\ProductPointSale\Service;
  3. use common\logic\AbstractBuilder;
  4. use common\logic\PointSale\PointSale\Model\PointSale;
  5. use common\logic\Product\Product\Model\Product;
  6. use common\logic\Product\ProductPointSale\Model\ProductPointSale;
  7. class ProductPointSaleBuilder extends AbstractBuilder
  8. {
  9. public function instanciateProductPointSale(): ProductPointSale
  10. {
  11. $productPointSale = new ProductPointSale();
  12. return $productPointSale;
  13. }
  14. public function createProductPointSale(Product $product, PointSale $pointSale, bool $available): ProductPointSale
  15. {
  16. $productPointSale = $this->instanciateProductPointSale();
  17. $productPointSale->populateProduct($product);
  18. $productPointSale->populatePointSale($pointSale);
  19. $productPointSale->available = $available;
  20. $this->saveCreate($productPointSale);
  21. return $productPointSale;
  22. }
  23. }