Browse Source

Settings : adaptation factory

packProduct
Guillaume 3 years ago
parent
commit
5047a6c952
6 changed files with 9 additions and 13 deletions
  1. +1
    -6
      EventSubscriber/SettingEventSubscriber.php
  2. +1
    -0
      Factory/Section/OpeningFactory.php
  3. +3
    -3
      Factory/Setting/MerchantSettingFactory.php
  4. +3
    -3
      Factory/Setting/SectionSettingFactory.php
  5. +1
    -0
      Model/Section/SectionModel.php
  6. +0
    -1
      Resolver/SectionResolver.php

+ 1
- 6
EventSubscriber/SettingEventSubscriber.php View File

@@ -80,11 +80,6 @@ class SettingEventSubscriber implements EventSubscriberInterface
}

if ($createEntitySetting) {
if ($type == 'section') {
$factory->setSection($entity);
} elseif ($type == 'merchant') {
$factory->setMerchant($entity);
}

$text = null;
$date = null;
@@ -100,7 +95,7 @@ class SettingEventSubscriber implements EventSubscriberInterface
$file = $fieldValue;
}

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

$this->em->persist($entitySetting);
}

+ 1
- 0
Factory/Section/OpeningFactory.php View File

@@ -20,6 +20,7 @@ class OpeningFactory extends AbstractFactory implements OpeningFactoryInterface
$opening = new Opening();

$opening->setSection($this->section);
$opening->setDay($day);
$opening->setTimeStart($timeStart);
$opening->setTimeEnd($timeEnd);
$opening->setGroupUser($groupUser);

+ 3
- 3
Factory/Setting/MerchantSettingFactory.php View File

@@ -4,18 +4,18 @@ namespace Lc\CaracoleBundle\Factory\Setting;

use App\Entity\Setting\MerchantSetting;
use Lc\CaracoleBundle\Factory\MerchantFactoryTrait;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\File\FileInterface;

class MerchantSettingFactory extends AbstractFactory
{
use MerchantFactoryTrait;

public function create(string $name, string $text = null, \DateTime $date = null, FileInterface $file = null)
public function create(MerchantInterface $merchant, string $name, string $text = null, \DateTime $date = null, FileInterface $file = null)
{
$merchantSetting = new MerchantSetting();

$merchantSetting->setMerchant($this->merchant);
$merchantSetting->setMerchant($merchant);
$merchantSetting->setName($name);
$merchantSetting->setText($text);
$merchantSetting->setDate($date);

+ 3
- 3
Factory/Setting/SectionSettingFactory.php View File

@@ -4,18 +4,18 @@ namespace Lc\CaracoleBundle\Factory\Setting;

use App\Entity\Setting\SectionSetting;
use Lc\CaracoleBundle\Factory\SectionFactoryTrait;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Factory\AbstractFactory;
use Lc\SovBundle\Model\File\FileInterface;

class SectionSettingFactory extends AbstractFactory
{
use SectionFactoryTrait;

public function create(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($this->section);
$merchantSetting->setSection($section);
$merchantSetting->setName($name);
$merchantSetting->setText($text);
$merchantSetting->setDate($date);

+ 1
- 0
Model/Section/SectionModel.php View File

@@ -84,6 +84,7 @@ abstract class SectionModel extends AbstractFullEntity implements FilterMerchant
$this->productFamilies = new ArrayCollection();
$this->orderShops = new ArrayCollection();
$this->openings = new ArrayCollection();
$this->productCategories = new ArrayCollection();
}

public function __toString()

+ 0
- 1
Resolver/SectionResolver.php View File

@@ -3,7 +3,6 @@
* @author La clic ! <contact@laclic.fr>
*/


namespace Lc\CaracoleBundle\Resolver;

use Doctrine\ORM\EntityManagerInterface;

Loading…
Cancel
Save