Example #1
0
 /**
  * @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);
     }
 }
Example #2
0
 /**
  * @Given /^(this product) has ([^"]+) attribute "([^"]+)" with date "([^"]+)"$/
  */
 public function thisProductHasDateTimeAttributeWithDate(ProductInterface $product, $productAttributeType, $productAttributeName, $date)
 {
     $attribute = $this->createProductAttribute($productAttributeType, $productAttributeName);
     $attributeValue = $this->createProductAttributeValue(new \DateTime($date), $attribute);
     $product->addAttribute($attributeValue);
     $this->objectManager->flush();
 }