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

} }


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


$text = null; $text = null;
$date = null; $date = null;
$file = $fieldValue; $file = $fieldValue;
} }


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


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

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

$opening = new Opening(); $opening = new Opening();


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

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



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


class MerchantSettingFactory extends AbstractFactory 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 = new MerchantSetting();


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

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



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


class SectionSettingFactory extends AbstractFactory 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 = new SectionSetting();


$merchantSetting->setSection($this->section);
$merchantSetting->setSection($section);
$merchantSetting->setName($name); $merchantSetting->setName($name);
$merchantSetting->setText($text); $merchantSetting->setText($text);
$merchantSetting->setDate($date); $merchantSetting->setDate($date);

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

$this->productFamilies = new ArrayCollection(); $this->productFamilies = new ArrayCollection();
$this->orderShops = new ArrayCollection(); $this->orderShops = new ArrayCollection();
$this->openings = new ArrayCollection(); $this->openings = new ArrayCollection();
$this->productCategories = new ArrayCollection();
} }


public function __toString() public function __toString()

+ 0
- 1
Resolver/SectionResolver.php View File

* @author La clic ! <contact@laclic.fr> * @author La clic ! <contact@laclic.fr>
*/ */



namespace Lc\CaracoleBundle\Resolver; namespace Lc\CaracoleBundle\Resolver;


use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;

Loading…
Cancel
Save