/** * Creates a media and add it to given product instance * * @param string $mediaFilename A media filename * @param string $name A media name to set on creation * @param string $description A media description text * @param ProductInterface $product A Product instance to add media * @param string $author A media author text * @param string $copyright A media copyright text */ protected function addMediaToProduct($mediaFilename, $name, $description, ProductInterface $product, $author = null, $copyright = null, $categoryReference = 'products_category') { $product->setImage($this->createMedia($mediaFilename, $name, $description, $author, $copyright, $categoryReference)); }