|
123456789101112131415161718192021222324252627 |
- <?php
-
- namespace Lc\CaracoleBundle\Factory\Product;
-
- use App\Entity\Product\ProductFamily;
- use Lc\CaracoleBundle\Context\SectionContextTrait;
- use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
- use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
- use Lc\CaracoleBundle\Model\Section\SectionInterface;
- use Lc\SovBundle\Factory\AbstractFactory;
-
- class ProductFamilyFactory extends AbstractFactory
- {
- public function create(MerchantInterface $merchant): ProductFamilyInterface
- {
- $productFamily = new ProductFamily();
-
- $productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();
-
- foreach($merchant->getSections() as $section) {
- $productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
- $productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
- }
-
- return $productFamily;
- }
- }
|