/** * Saves the passed shop configuration values to the passed * template. * The configuration elements are identified over the * element name. * The values array can contains multiple sub shop values, * which identified over the shopId parameter inside the values array. * * @param Shop\Template $template * @param array $values */ public function saveConfig(Shop\Template $template, array $values) { foreach ($values as $data) { //get the element over the name $element = $this->getElementByName($template->getElements(), $data['elementName']); if (!$element instanceof Shop\TemplateConfig\Element) { continue; } $value = $this->getElementShopValue($element->getValues(), $data['shopId']); /**@var $shop Shop\Shop */ $shop = $this->entityManager->getReference('Shopware\\Models\\Shop\\Shop', $data['shopId']); if ($element->getType() === 'theme-media-selection') { $data['value'] = $this->mediaService->normalize($data['value']); } $value->setShop($shop); $value->setElement($element); $value->setValue($data['value']); } $this->entityManager->flush(); }
/** * Adds a media by path to used table * * @param $path */ private function addMediaByPath($path) { $path = $this->mediaService->normalize($path); $this->queue['path'][] = $path; }