/** * @param ProductInterface $product * @param array $options */ private function createRelations(ProductInterface $product, array $options) { foreach ($options['taxons'] as $taxon) { $product->addTaxon($taxon); } foreach ($options['channels'] as $channel) { $product->addChannel($channel); } foreach ($options['product_options'] as $option) { $product->addOption($option); } foreach ($options['product_attributes'] as $attribute) { $product->addAttribute($attribute); } }
/** * @Given /^(this product) has (this product option)$/ * @Given /^(this product) has a ("[^"]+" option)$/ * @Given /^(this product) has an ("[^"]+" option)$/ */ public function thisProductHasThisProductOption(ProductInterface $product, OptionInterface $option) { $product->addOption($option); $this->objectManager->flush(); }