Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

31 linhas
1.0KB

  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\Section\SectionInterface;
  8. use Lc\SovBundle\Factory\AbstractFactory;
  9. class ProductFamilyFactory extends AbstractFactory
  10. {
  11. public function create(MerchantInterface $merchant): ProductFamilyInterface
  12. {
  13. $productFamily = new ProductFamily();
  14. $productFamily->setSaleStatus(true);
  15. $productFamily->setStatus(1);
  16. $productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();
  17. foreach($merchant->getSections() as $section) {
  18. $productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
  19. $productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
  20. }
  21. return $productFamily;
  22. }
  23. }