Nie możesz wybrać więcej, niż 25 tematów
Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
|
- <?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\Product\ProductFamilyModel;
- use Lc\CaracoleBundle\Model\Section\SectionInterface;
- use Lc\SovBundle\Factory\AbstractFactory;
-
- class ProductFamilyFactory extends AbstractFactory
- {
- public function create(MerchantInterface $merchant): ProductFamilyInterface
- {
- $productFamily = new ProductFamily();
-
- $productFamily->setBehaviorAddToCart(ProductFamilyModel::BEHAVIOR_ADD_TO_CART_SIMPLE);
- $productFamily->setSaleStatus(true);
- $productFamily->setStatus(1);
-
- $productFamilySectionPropertyFactory = new ProductFamilySectionPropertyFactory();
-
- foreach($merchant->getSections() as $section) {
- $productFamilySectionProperty = $productFamilySectionPropertyFactory->create($section, $productFamily);
- $productFamily->addProductFamilySectionProperty($productFamilySectionProperty);
- }
-
- return $productFamily;
- }
- }
|