} | } | ||||
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); | ||||
} | } |
$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); |
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); |
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); |
$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() |
* @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; |