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
906B

  1. <?php
  2. namespace common\logic\Product\ProductPointSale;
  3. use common\logic\BaseBuilder;
  4. use common\logic\BuilderInterface;
  5. use common\logic\PointSale\PointSale\PointSale;
  6. use common\logic\Product\Product\Product;
  7. class ProductPointSaleBuilder extends BaseBuilder implements BuilderInterface
  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->availability = $available;
  20. $this->saveCreate($productPointSale);
  21. return $productPointSale;
  22. }
  23. }