<?php | |||||
namespace Lc\CaracoleBundle\Builder\PointSale; | |||||
class PointSaleSectionBuilder | |||||
{ | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Container\PointSale; | |||||
use Lc\CaracoleBundle\Builder\PointSale\PointSaleSectionBuilder; | |||||
use Lc\CaracoleBundle\Factory\PointSale\PointSaleSectionFactory; | |||||
use Lc\CaracoleBundle\Repository\PointSale\PointSaleSectionRepositoryQuery; | |||||
use Lc\CaracoleBundle\Repository\PointSale\PointSaleSectionStore; | |||||
class PointSaleSectionContainer | |||||
{ | |||||
protected PointSaleSectionFactory $factory; | |||||
protected PointSaleSectionRepositoryQuery $repositoryQuery; | |||||
protected PointSaleSectionStore $store; | |||||
protected PointSaleSectionBuilder $builder; | |||||
public function __construct( | |||||
PointSaleSectionFactory $factory, | |||||
PointSaleSectionRepositoryQuery $repositoryQuery, | |||||
PointSaleSectionStore $store, | |||||
PointSaleSectionBuilder $builder | |||||
) { | |||||
$this->factory = $factory; | |||||
$this->repositoryQuery = $repositoryQuery; | |||||
$this->store = $store; | |||||
$this->builder = $builder; | |||||
} | |||||
public function getFactory(): PointSaleSectionFactory | |||||
{ | |||||
return $this->factory; | |||||
} | |||||
public function getRepositoryQuery(): PointSaleSectionRepositoryQuery | |||||
{ | |||||
return $this->repositoryQuery; | |||||
} | |||||
public function getStore(): PointSaleSectionStore | |||||
{ | |||||
$this->store->resetContext(); | |||||
return $this->store; | |||||
} | |||||
public function getBuilder(): PointSaleSectionBuilder | |||||
{ | |||||
return $this->builder; | |||||
} | |||||
} |
use Lc\CaracoleBundle\Container\Order\OrderStatusContainer; | use Lc\CaracoleBundle\Container\Order\OrderStatusContainer; | ||||
use Lc\CaracoleBundle\Container\Order\OrderStatusHistoryContainer; | use Lc\CaracoleBundle\Container\Order\OrderStatusHistoryContainer; | ||||
use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer; | use Lc\CaracoleBundle\Container\PointSale\PointSaleContainer; | ||||
use Lc\CaracoleBundle\Container\PointSale\PointSaleSectionContainer; | |||||
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer; | use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer; | ||||
use Lc\CaracoleBundle\Container\Product\ProductContainer; | use Lc\CaracoleBundle\Container\Product\ProductContainer; | ||||
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; | use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; | ||||
DistributionContainer::class => DistributionContainer::class, | DistributionContainer::class => DistributionContainer::class, | ||||
ProductFamilySectionPropertyContainer::class => ProductFamilySectionPropertyContainer::class, | ProductFamilySectionPropertyContainer::class => ProductFamilySectionPropertyContainer::class, | ||||
QualityLabelContainer::class => QualityLabelContainer::class, | QualityLabelContainer::class => QualityLabelContainer::class, | ||||
PointSaleSectionContainer::class => PointSaleSectionContainer::class, | |||||
] | ] | ||||
); | ); | ||||
} | } | ||||
{ | { | ||||
return $this->get(QualityLabelContainer::class); | return $this->get(QualityLabelContainer::class); | ||||
} | } | ||||
public function getPointSaleSectionContainer(): PointSaleSectionContainer | |||||
{ | |||||
return $this->get(PointSaleSectionContainer::class); | |||||
} | |||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Factory\PointSale; | |||||
use App\Entity\PointSale\PointSaleSection; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleSectionInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Factory\AbstractFactory; | |||||
class PointSaleSectionFactory extends AbstractFactory | |||||
{ | |||||
public function create(PointSaleInterface $pointSale, SectionInterface $section): PointSaleSectionInterface | |||||
{ | |||||
$pointSaleSection = new PointSaleSection(); | |||||
$pointSaleSection->setPointSale($pointSale); | |||||
$pointSaleSection->setSection($section); | |||||
return $pointSaleSection; | |||||
} | |||||
} |
interface PointSaleInterface | interface PointSaleInterface | ||||
{ | { | ||||
public function getTitle(): ?string; | public function getTitle(): ?string; | ||||
public function setTitle(string $title); | public function setTitle(string $title); | ||||
public function getDescription(): ?string; | public function getDescription(): ?string; | ||||
public function setDescription(?string $description); | public function setDescription(?string $description); | ||||
public function getCreatedBy(): ?UserInterface; | public function getCreatedBy(): ?UserInterface; | ||||
public function setCreatedBy(?UserInterface $createdBy); | public function setCreatedBy(?UserInterface $createdBy); | ||||
public function getUpdatedBy(): ?UserInterface; | public function getUpdatedBy(): ?UserInterface; | ||||
public function setUpdatedBy(?UserInterface $updatedBy); | public function setUpdatedBy(?UserInterface $updatedBy); | ||||
public function getDevAlias(): ?string; | public function getDevAlias(): ?string; | ||||
public function setDevAlias(?string $devAlias); | public function setDevAlias(?string $devAlias); | ||||
public function getOrderAmountMin(): ?float; | public function getOrderAmountMin(): ?float; | ||||
public function setOrderAmountMin(float $orderAmountMin): PointSaleInterface; | public function setOrderAmountMin(float $orderAmountMin): PointSaleInterface; | ||||
/** | /** | ||||
* @return Collection|MerchantInterface[] | * @return Collection|MerchantInterface[] | ||||
*/ | */ | ||||
public function getMerchants(): Collection; | public function getMerchants(): Collection; | ||||
public function addMerchant(MerchantInterface $merchant): PointSaleInterface; | public function addMerchant(MerchantInterface $merchant): PointSaleInterface; | ||||
public function removeMerchant(MerchantInterface $merchant): PointSaleInterface; | public function removeMerchant(MerchantInterface $merchant): PointSaleInterface; | ||||
public function getCode(): ?string; | public function getCode(): ?string; | ||||
public function setCode(?string $code): PointSaleInterface; | public function setCode(?string $code): PointSaleInterface; | ||||
public function getDeliveryPrice(): ?float; | public function getDeliveryPrice(): ?float; | ||||
public function setDeliveryPrice(float $deliveryPrice): PointSaleInterface; | public function setDeliveryPrice(float $deliveryPrice): PointSaleInterface; | ||||
public function getIsPublic(): ?bool; | public function getIsPublic(): ?bool; | ||||
public function setIsPublic(bool $isPublic): PointSaleInterface; | public function setIsPublic(bool $isPublic): PointSaleInterface; | ||||
public function getAddress(): ?AddressInterface; | public function getAddress(): ?AddressInterface; | ||||
public function setAddress(AddressInterface $address): PointSaleInterface; | public function setAddress(AddressInterface $address): PointSaleInterface; | ||||
/** | /** | ||||
* @return Collection|UserPointSaleInterface[] | * @return Collection|UserPointSaleInterface[] | ||||
*/ | */ | ||||
public function getUserPointSales(): Collection; | public function getUserPointSales(): Collection; | ||||
public function addUserPointSale(UserPointSaleInterface $userPointSale | public function addUserPointSale(UserPointSaleInterface $userPointSale | ||||
): PointSaleInterface; | ): PointSaleInterface; | ||||
public function removeUserPointSale(UserPointSaleInterface $userPointSale | public function removeUserPointSale(UserPointSaleInterface $userPointSale | ||||
): PointSaleInterface; | ): PointSaleInterface; | ||||
public function getImage(): ?File; | public function getImage(): ?File; | ||||
public function setImage(?File $image): PointSaleInterface; | public function setImage(?File $image): PointSaleInterface; | ||||
public function getMetaTitle(): ?string; | public function getMetaTitle(): ?string; | ||||
public function setMetaTitle(?string $metaTitle); | public function setMetaTitle(?string $metaTitle); | ||||
public function getMetaDescription(): ?string; | public function getMetaDescription(): ?string; | ||||
public function setMetaDescription(?string $metaDescription); | public function setMetaDescription(?string $metaDescription); | ||||
public function setOldUrls($oldUrls); | public function setOldUrls($oldUrls); | ||||
public function getOldUrls(): ?array; | public function getOldUrls(): ?array; | ||||
public function getSlug(): ?string; | public function getSlug(): ?string; | ||||
public function setSlug(?string $slug); | public function setSlug(?string $slug); | ||||
/** | /** | ||||
* @return $this | * @return $this | ||||
*/ | */ | ||||
public function setPosition(float $position); | public function setPosition(float $position); | ||||
public function clearPosition(); | public function clearPosition(); | ||||
public function getStatus(): ?float; | public function getStatus(): ?float; | ||||
public function setStatus(float $status); | public function setStatus(float $status); | ||||
public function getCreatedAt(): ?\DateTimeInterface; | public function getCreatedAt(): ?\DateTimeInterface; | ||||
public function setCreatedAt(\DateTimeInterface $createdAt); | public function setCreatedAt(\DateTimeInterface $createdAt); | ||||
public function getUpdatedAt(): ?\DateTimeInterface; | public function getUpdatedAt(): ?\DateTimeInterface; | ||||
public function setUpdatedAt(\DateTimeInterface $updatedAt); | public function setUpdatedAt(\DateTimeInterface $updatedAt); | ||||
/** | |||||
* @return Collection|PointSaleSectionInterface[] | |||||
*/ | |||||
public function getPointSaleSections(): Collection; | |||||
public function addPointSaleSection(PointSaleSectionInterface $pointSaleSection): PointSaleInterface; | |||||
public function removePointSaleSection(PointSaleSectionInterface $pointSaleSection): PointSaleInterface; | |||||
} | } |
abstract class PointSaleModel extends AbstractFullEntity implements FilterMultipleMerchantsInterface, | abstract class PointSaleModel extends AbstractFullEntity implements FilterMultipleMerchantsInterface, | ||||
OrderAmountMinInterface, PointSaleInterface | OrderAmountMinInterface, PointSaleInterface | ||||
{ | { | ||||
use OrderAmountMinTrait; | use OrderAmountMinTrait; | ||||
/** | /** | ||||
*/ | */ | ||||
protected $image; | protected $image; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleSectionInterface", mappedBy="pointSale", cascade={"persist"}) | |||||
*/ | |||||
protected $pointSaleSections; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->merchants = new ArrayCollection(); | $this->merchants = new ArrayCollection(); | ||||
$this->userPointSales = new ArrayCollection(); | $this->userPointSales = new ArrayCollection(); | ||||
$this->pointSaleSections = new ArrayCollection(); | |||||
} | } | ||||
public function __toString() | public function __toString() | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getDeliveryPrice(): ?float | public function getDeliveryPrice(): ?float | ||||
{ | { | ||||
return $this->deliveryPrice; | return $this->deliveryPrice; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|PointSaleSectionInterface[] | |||||
*/ | |||||
public function getPointSaleSections(): Collection | |||||
{ | |||||
return $this->pointSaleSections; | |||||
} | |||||
public function addPointSaleSection(PointSaleSectionInterface $pointSaleSection): self | |||||
{ | |||||
if (!$this->pointSaleSections->contains($pointSaleSection)) { | |||||
$this->pointSaleSections[] = $pointSaleSection; | |||||
$pointSaleSection->setPointSale($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removePointSaleSection(PointSaleSectionInterface $pointSaleSection): self | |||||
{ | |||||
if ($this->pointSaleSections->removeElement($pointSaleSection)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($pointSaleSection->getPointSale() === $this) { | |||||
$pointSaleSection->setPointSale(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Model\PointSale; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
interface PointSaleSectionInterface | |||||
{ | |||||
public function getSection(): SectionInterface; | |||||
public function setSection(SectionInterface $section): PointSaleSectionInterface; | |||||
public function getPointSale(): PointSaleInterface; | |||||
public function setPointSale(PointSaleInterface $pointSale): PointSaleSectionInterface; | |||||
public function getOrderAmountMin(): ?float; | |||||
public function setOrderAmountMin(float $orderAmountMin): self; | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Model\PointSale; | |||||
use Doctrine\ORM\Mapping as ORM; | |||||
use Lc\CaracoleBundle\Doctrine\Extension\OrderAmountMinTrait; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\SovBundle\Doctrine\EntityInterface; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
abstract class PointSaleSectionModel implements EntityInterface, PointSaleSectionInterface | |||||
{ | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="pointSaleSections") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $section; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleInterface", inversedBy="pointSaleSections") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $pointSale; | |||||
/** | |||||
* @ORM\Column(type="float", nullable=true) | |||||
*/ | |||||
protected $orderAmountMin; | |||||
public function getSection(): SectionInterface | |||||
{ | |||||
return $this->section; | |||||
} | |||||
public function setSection(SectionInterface $section): self | |||||
{ | |||||
$this->section = $section; | |||||
return $this; | |||||
} | |||||
public function getPointSale(): PointSaleInterface | |||||
{ | |||||
return $this->pointSale; | |||||
} | |||||
public function setPointSale(PointSaleInterface $pointSale): self | |||||
{ | |||||
$this->pointSale = $pointSale; | |||||
return $this; | |||||
} | |||||
public function getOrderAmountMin(): ?float | |||||
{ | |||||
return $this->orderAmountMin; | |||||
} | |||||
public function setOrderAmountMin(?float $orderAmountMin): self | |||||
{ | |||||
$this->orderAmountMin = $orderAmountMin; | |||||
return $this; | |||||
} | |||||
} |
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleSectionInterface; | |||||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface; | ||||
use Lc\CaracoleBundle\Model\Setting\SectionSettingInterface; | use Lc\CaracoleBundle\Model\Setting\SectionSettingInterface; | ||||
public function getUpdatedAt(): ?\DateTimeInterface; | public function getUpdatedAt(): ?\DateTimeInterface; | ||||
public function setUpdatedAt(\DateTimeInterface $updatedAt); | public function setUpdatedAt(\DateTimeInterface $updatedAt); | ||||
/** | |||||
* @return Collection|PointSaleSectionInterface[] | |||||
*/ | |||||
public function getPointSaleSections(): Collection; | |||||
public function addPointSaleSection(PointSaleSectionInterface $pointSaleSection): SectionInterface; | |||||
public function removePointSaleSection(PointSaleSectionInterface $pointSaleSection): SectionInterface; | |||||
} | } |
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleSectionInterface; | |||||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface; | ||||
use Lc\CaracoleBundle\Model\Setting\SectionSettingInterface; | use Lc\CaracoleBundle\Model\Setting\SectionSettingInterface; | ||||
*/ | */ | ||||
protected $productFamilySectionProperties; | protected $productFamilySectionProperties; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleSectionInterface", mappedBy="section") | |||||
*/ | |||||
protected $pointSaleSections; | |||||
public function __construct() | public function __construct() | ||||
{ | { | ||||
$this->orderShops = new ArrayCollection(); | $this->orderShops = new ArrayCollection(); | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|PointSaleSectionInterface[] | |||||
*/ | |||||
public function getPointSaleSections(): Collection | |||||
{ | |||||
return $this->pointSaleSections; | |||||
} | |||||
public function addPointSaleSection(PointSaleSectionInterface $pointSaleSection): self | |||||
{ | |||||
if (!$this->pointSaleSections->contains($pointSaleSection)) { | |||||
$this->pointSaleSections[] = $pointSaleSection; | |||||
$pointSaleSection->setSection($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removePointSaleSection(PointSaleSectionInterface $pointSaleSection): self | |||||
{ | |||||
if ($this->pointSaleSections->removeElement($pointSaleSection)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($pointSaleSection->getSection() === $this) { | |||||
$pointSaleSection->setSection(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
} | } |
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
public function innerJoinDeliveryAvailabilityPointSale() | |||||
{ | |||||
return $this->innerJoin('.deliveryAvailabilityPointSale'); | |||||
} | |||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\PointSale; | |||||
use App\Entity\PointSale\PointSaleSection; | |||||
use Doctrine\Persistence\ManagerRegistry; | |||||
use Lc\SovBundle\Repository\AbstractRepository; | |||||
class PointSaleSectionRepository extends AbstractRepository | |||||
{ | |||||
public function __construct(ManagerRegistry $registry) | |||||
{ | |||||
parent::__construct($registry, PointSaleSection::class); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\PointSale; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\CaracoleBundle\Repository\SectionRepositoryQueryTrait; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | |||||
class PointSaleSectionRepositoryQuery extends AbstractRepositoryQuery | |||||
{ | |||||
use SectionRepositoryQueryTrait; | |||||
public function __construct(PointSaleSectionRepository $repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, 'pointSaleSection', $paginator); | |||||
} | |||||
public function filterByPointSale(PointSaleInterface $pointSale): self | |||||
{ | |||||
return $this->andWhereEqual('pointSale', $pointSale); | |||||
} | |||||
} |
<?php | |||||
namespace Lc\CaracoleBundle\Repository\PointSale; | |||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\CaracoleBundle\Repository\AbstractStore; | |||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class PointSaleSectionStore extends AbstractStore | |||||
{ | |||||
use SectionStoreTrait; | |||||
protected PointSaleSectionRepositoryQuery $query; | |||||
public function __construct(PointSaleSectionRepositoryQuery $query) | |||||
{ | |||||
$this->query = $query; | |||||
} | |||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
$this->addFilterBySectionOptionnal($query); | |||||
return $query; | |||||
} | |||||
public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | |||||
{ | |||||
return $query; | |||||
} | |||||
public function getOneByPointSale(PointSaleInterface $pointSale, $query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query->filterByPointSale($pointSale); | |||||
return $query->findOne(); | |||||
} | |||||
} |
code: Code | code: Code | ||||
code_help: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse) | code_help: Code utilisé pour retrouver l'ambassade dans le tunnel de commande (Non sensible à la casse) | ||||
image: Image | image: Image | ||||
pointSaleSections: Sections | |||||
PointSaleSection: | |||||
fields: | |||||
orderAmountMin: Montant minimum de commande | |||||
Address: | Address: | ||||
fields: | fields: |
<?php | <?php | ||||
namespace Lc\CaracoleBundle\Solver\PointSale; | namespace Lc\CaracoleBundle\Solver\PointSale; | ||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
class PointSaleSolver | class PointSaleSolver | ||||
{ | { | ||||
return $html; | return $html; | ||||
} | } | ||||
public function getOrderAmountMin(PointSaleInterface $pointSale, SectionInterface $section) | |||||
{ | |||||
foreach($pointSale->getPointSaleSections() as $pointSaleSection) { | |||||
if($pointSaleSection->getSection()->getId() == $section->getId()) { | |||||
$orderAmountMin = $pointSaleSection->getOrderAmountMin(); | |||||
if(!is_null($orderAmountMin)) { | |||||
return $orderAmountMin; | |||||
} | |||||
} | |||||
} | |||||
return $pointSale->getOrderAmountMin(); | |||||
} | |||||
} | } |