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

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627
  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. $productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();
  15. foreach($merchant->getSections() as $section) {
  16. $productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
  17. $productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
  18. }
  19. return $productFamily;
  20. }
  21. }