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.

ProductFamilyFactory.php 1.1KB

3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace Lc\CaracoleBundle\Factory\Product;
  3. use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer;
  4. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  5. use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
  6. use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
  7. use Lc\SovBundle\Factory\AbstractFactory;
  8. class ProductFamilyFactory extends AbstractFactory
  9. {
  10. public function create(MerchantInterface $merchant): ProductFamilyInterface
  11. {
  12. $class = ProductFamilyContainer::getEntityFqcn();
  13. $productFamily = new $class;
  14. $productFamily->setBehaviorAddToCart(ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE);
  15. $productFamily->setSaleStatus(true);
  16. $productFamily->setStatus(1);
  17. $productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();
  18. foreach($merchant->getSections() as $section) {
  19. $productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
  20. $productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
  21. }
  22. return $productFamily;
  23. }
  24. }