Bläddra i källkod

Correctif

packProduct
Guillaume 3 år sedan
förälder
incheckning
f71993bf3f
2 ändrade filer med 7 tillägg och 5 borttagningar
  1. +2
    -3
      Controller/Merchant/SwitchMerchantController.php
  2. +5
    -2
      EventSubscriber/SettingEventSubscriber.php

+ 2
- 3
Controller/Merchant/SwitchMerchantController.php Visa fil

@@ -3,10 +3,9 @@
namespace Lc\CaracoleBundle\Controller\Merchant;

use Lc\CaracoleBundle\Container\Merchant\MerchantContainer;
use Lc\CaracoleBundle\Controller\AbstractController;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinition;
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

@@ -25,7 +24,7 @@ class SwitchMerchantController extends AbstractController
$context = $form->get('context')->getData();

if ($merchant) {
$url = $this->get(MerchantContainer::class)->getSettingSolver()->getSettingValue(
$url = $this->getSettingValue(
$merchant,
MerchantSettingDefinition::SETTING_URL
);

+ 5
- 2
EventSubscriber/SettingEventSubscriber.php Visa fil

@@ -59,7 +59,6 @@ class SettingEventSubscriber implements EventSubscriberInterface
$this->initSettingsGeneric(
'merchant',
$this->merchantSettingDefinition->getSettings(),
//TODO vérifier que ce soit bien les online que l'on souhaite
$merchants,
$this->merchantSettingFactory
);
@@ -79,11 +78,15 @@ class SettingEventSubscriber implements EventSubscriberInterface
if($entities) {
foreach ($entities as $entity) {

$this->entityManager->refresh($entity);

foreach ($settings as $category => $settingList) {
foreach ($settingList as $settingName => $setting) {

$entitySetting = $this->settingSolver->getSetting($entity, $settingName);

if (!$entitySetting) {

// gestion du cas des SectionSetting spécifiques à une section
$createEntitySetting = true;
if ($entity instanceof SectionInterface && isset($setting['section']) && $setting['section'] != $entity) {
@@ -107,7 +110,7 @@ class SettingEventSubscriber implements EventSubscriberInterface

$entitySetting = $factory->create($entity, $setting['name'], $text, $date, $file);

$this->entityManager->persist($entitySetting);
$this->entityManager->create($entitySetting);
}
} else {
if ($this->settingSolver->getValue($entitySetting) === null

Laddar…
Avbryt
Spara