Skip to content

Commit

Permalink
default product data have now availability set
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-rostislav authored Mar 10, 2020
1 parent 62156d3 commit 5720697
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/framework/src/Model/Product/ProductDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroupFacade;
use Shopsys\FrameworkBundle\Model\Pricing\Vat\VatFacade;
use Shopsys\FrameworkBundle\Model\Product\Accessory\ProductAccessoryRepository;
use Shopsys\FrameworkBundle\Model\Product\Availability\AvailabilityFacade;
use Shopsys\FrameworkBundle\Model\Product\Parameter\ParameterRepository;
use Shopsys\FrameworkBundle\Model\Product\Parameter\ProductParameterValueDataFactoryInterface;
use Shopsys\FrameworkBundle\Model\Product\Pricing\ProductInputPriceFacade;
Expand Down Expand Up @@ -76,6 +77,11 @@ class ProductDataFactory implements ProductDataFactoryInterface
*/
protected $pricingGroupFacade;

/**
* @var \Shopsys\FrameworkBundle\Model\Product\Availability\AvailabilityFacade
*/
protected $availabilityFacade;

/**
* @param \Shopsys\FrameworkBundle\Model\Pricing\Vat\VatFacade $vatFacade
* @param \Shopsys\FrameworkBundle\Model\Product\Pricing\ProductInputPriceFacade $productInputPriceFacade
Expand All @@ -89,6 +95,7 @@ class ProductDataFactory implements ProductDataFactoryInterface
* @param \Shopsys\FrameworkBundle\Component\Plugin\PluginCrudExtensionFacade $pluginDataFormExtensionFacade
* @param \Shopsys\FrameworkBundle\Model\Product\Parameter\ProductParameterValueDataFactoryInterface $productParameterValueDataFactory
* @param \Shopsys\FrameworkBundle\Model\Pricing\Group\PricingGroupFacade $pricingGroupFacade
* @param \Shopsys\FrameworkBundle\Model\Product\Availability\AvailabilityFacade $availabilityFacade
*/
public function __construct(
VatFacade $vatFacade,
Expand All @@ -102,7 +109,8 @@ public function __construct(
ImageFacade $imageFacade,
PluginCrudExtensionFacade $pluginDataFormExtensionFacade,
ProductParameterValueDataFactoryInterface $productParameterValueDataFactory,
PricingGroupFacade $pricingGroupFacade
PricingGroupFacade $pricingGroupFacade,
AvailabilityFacade $availabilityFacade
) {
$this->vatFacade = $vatFacade;
$this->productInputPriceFacade = $productInputPriceFacade;
Expand All @@ -116,6 +124,7 @@ public function __construct(
$this->pluginDataFormExtensionFacade = $pluginDataFormExtensionFacade;
$this->productParameterValueDataFactory = $productParameterValueDataFactory;
$this->pricingGroupFacade = $pricingGroupFacade;
$this->availabilityFacade = $availabilityFacade;
}

/**
Expand Down Expand Up @@ -159,6 +168,7 @@ protected function fillNew(ProductData $productData)
$productData->name[$locale] = null;
$productData->variantAlias[$locale] = null;
}
$productData->availability = $this->availabilityFacade->getDefaultInStockAvailability();
}

/**
Expand Down

0 comments on commit 5720697

Please sign in to comment.