Browse Source

Merge branch 'feature/module_traiteur_v1' of https://gitea.laclic.fr/Laclic/LcShopBundle into feature/module_traiteur_v1

feature/module_traiteur_v1
Fab 4 years ago
parent
commit
ec8599b1f5
3 changed files with 132 additions and 2 deletions
  1. +18
    -1
      ShopBundle/Model/OrderShop.php
  2. +31
    -1
      ShopBundle/Model/ProductFamily.php
  3. +83
    -0
      ShopBundle/Model/Section.php

+ 18
- 1
ShopBundle/Model/OrderShop.php View File

*/ */
protected $updatedBy; protected $updatedBy;



/** /**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop") * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketInterface", mappedBy="orderShop")
*/ */
protected $tickets; protected $tickets;


/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="orderShops")
* @ORM\JoinColumn(nullable=false)
*/
protected $section;

public function __construct() public function __construct()
{ {
$this->orderStatusHistories = new ArrayCollection(); $this->orderStatusHistories = new ArrayCollection();
return false ; return false ;
} }


public function getSection(): ?Section
{
return $this->section;
}

public function setSection(?Section $section): self
{
$this->section = $section;

return $this;
}

} }

+ 31
- 1
ShopBundle/Model/ProductFamily.php View File

*/ */
protected $behaviorPrice; protected $behaviorPrice;



/** /**
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
protected $saleStatus; protected $saleStatus;


/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\SectionInterface", inversedBy="productFamilies")
*/
protected $sections;

public function __construct() public function __construct()
{ {
$this->productCategories = new ArrayCollection(); $this->productCategories = new ArrayCollection();


return $this; return $this;
} }

/**
* @return Collection|Section[]
*/
public function getSections(): Collection
{
return $this->sections;
}

public function addSection(Section $section): self
{
if (!$this->sections->contains($section)) {
$this->sections[] = $section;
}

return $this;
}

public function removeSection(Section $section): self
{
if ($this->sections->contains($section)) {
$this->sections->removeElement($section);
}

return $this;
}
} }

+ 83
- 0
ShopBundle/Model/Section.php View File



namespace Lc\ShopBundle\Model; namespace Lc\ShopBundle\Model;


use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;


/** /**
*/ */
class Section extends AbstractDocumentEntity class Section extends AbstractDocumentEntity
{ {
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/** /**
* @ORM\Column(type="string", length=32) * @ORM\Column(type="string", length=32)
*/ */
const SECTION_CYCLE_MONTH = 'month' ; const SECTION_CYCLE_MONTH = 'month' ;
const SECTION_CYCLE_YEAR = 'year' ; const SECTION_CYCLE_YEAR = 'year' ;


/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", mappedBy="sections")
*/
protected $productFamilies;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="section")
*/
protected $orderShops;

public function __construct()
{
$this->productFamilies = new ArrayCollection();
$this->orderShops = new ArrayCollection();
}

public function getCycle(): ?string public function getCycle(): ?string
{ {
return $this->cycle; return $this->cycle;


return $this; return $this;
} }

/**
* @return Collection|ProductFamily[]
*/
public function getProductFamilies(): Collection
{
return $this->productFamilies;
}

public function addProductFamily(ProductFamily $productFamily): self
{
if (!$this->productFamilies->contains($productFamily)) {
$this->productFamilies[] = $productFamily;
$productFamily->addSection($this);
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
$productFamily->removeSection($this);
}

return $this;
}

/**
* @return Collection|OrderShop[]
*/
public function getOrderShops(): Collection
{
return $this->orderShops;
}

public function addOrderShop(OrderShop $orderShop): self
{
if (!$this->orderShops->contains($orderShop)) {
$this->orderShops[] = $orderShop;
$orderShop->setSection($this);
}

return $this;
}

public function removeOrderShop(OrderShop $orderShop): self
{
if ($this->orderShops->contains($orderShop)) {
$this->orderShops->removeElement($orderShop);
// set the owning side to null (unless already changed)
if ($orderShop->getSection() === $this) {
$orderShop->setSection(null);
}
}

return $this;
}
} }

Loading…
Cancel
Save