Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ProductFamilyFactory.php 1.2KB

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