Sylius\Behat\Context\Setup\ProductContext::thisProductIsAlsoPricedAtInChannel PHP Method

thisProductIsAlsoPricedAtInChannel() public method

public thisProductIsAlsoPricedAtInChannel ( Sylius\Component\Core\Model\ProductInterface $product, $price, Sylius\Component\Core\Model\ChannelInterface $channel )
$product Sylius\Component\Core\Model\ProductInterface
$channel Sylius\Component\Core\Model\ChannelInterface
    public function thisProductIsAlsoPricedAtInChannel(ProductInterface $product, $price, ChannelInterface $channel)
    {
        $product->addChannel($channel);
        /** @var ProductVariantInterface $productVariant */
        $productVariant = $this->defaultVariantResolver->getVariant($product);
        /** @var ChannelPricingInterface $channelPricing */
        $channelPricing = $this->channelPricingFactory->createNew();
        $channelPricing->setPrice($price);
        $channelPricing->setChannel($channel);
        $productVariant->addChannelPricing($channelPricing);
        $this->objectManager->flush();
    }