소스 검색

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Fabien Normand 2 년 전
부모
커밋
00d50d6547
3개의 변경된 파일20개의 추가작업 그리고 9개의 파일을 삭제
  1. +12
    -7
      EventSubscriber/SettingEventSubscriber.php
  2. +1
    -0
      Factory/Section/SectionFactory.php
  3. +7
    -2
      Factory/Setting/SectionSettingFactory.php

+ 12
- 7
EventSubscriber/SettingEventSubscriber.php 파일 보기

@@ -94,14 +94,14 @@ class SettingEventSubscriber implements EventSubscriberInterface
$date = null;
$file = null;

$fieldValue = isset($setting['default']) ? $setting['default'] : null;
$valueDefault = isset($setting['default']) ? $this->settingSolver->getDefaultValue($entity, $setting['default']) : null;

if ($setting['field'] == 'text') {
$text = $fieldValue;
$text = $valueDefault;
} elseif ($setting['field'] == 'date') {
$date = $fieldValue;
$date = $valueDefault;
} elseif ($setting['field'] == 'file') {
$file = $fieldValue;
$file = $valueDefault;
}

$entitySetting = $factory->create($entity, $setting['name'], $text, $date, $file);
@@ -112,9 +112,14 @@ class SettingEventSubscriber implements EventSubscriberInterface
if ($this->settingSolver->getValue($entitySetting) === null
&& isset($setting['default'])
&& $setting['default'] !== null) {
$methodSetValue = 'set' . ucfirst($setting['field']);
$entitySetting->$methodSetValue($setting['default']);
$this->entityManager->update($entitySetting);

$valueDefault = $this->settingSolver->getDefaultValue($entity, $setting['default']);

if($valueDefault) {
$methodSetValue = 'set' . ucfirst($setting['field']);
$entitySetting->$methodSetValue($valueDefault);
$this->entityManager->update($entitySetting);
}
}
}
}

+ 1
- 0
Factory/Section/SectionFactory.php 파일 보기

@@ -16,6 +16,7 @@ class SectionFactory extends AbstractFactory
$section = new Section();

$section->setMerchant($merchant);
$section->setStatus(1);

return $section;
}

+ 7
- 2
Factory/Setting/SectionSettingFactory.php 파일 보기

@@ -11,8 +11,13 @@ use Lc\SovBundle\Model\File\FileInterface;
class SectionSettingFactory extends AbstractFactory
{

public function create(SectionInterface $section, string $name, string $text = null, \DateTime $date = null, FileInterface $file = null)
{
public function create(
SectionInterface $section,
string $name,
string $text = null,
\DateTime $date = null,
FileInterface $file = null
) {
$merchantSetting = new SectionSetting();

$merchantSetting->setSection($section);

Loading…
취소
저장