@@ -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); | |||
} |
@@ -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); |
@@ -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); |
@@ -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); |
@@ -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() |
@@ -3,7 +3,6 @@ | |||
* @author La clic ! <contact@laclic.fr> | |||
*/ | |||
namespace Lc\CaracoleBundle\Resolver; | |||
use Doctrine\ORM\EntityManagerInterface; |