Просмотр исходного кода

Création des modèles / entités / interfaces

reduction
Guillaume Bourgeois 4 лет назад
Родитель
Сommit
491805bf8a
42 измененных файлов: 2741 добавлений и 14 удалений
  1. +8
    -0
      ShopBundle/Context/AddressInterface.php
  2. +8
    -0
      ShopBundle/Context/CartInterface.php
  3. +8
    -0
      ShopBundle/Context/CartProductInterface.php
  4. +8
    -0
      ShopBundle/Context/CreditConfigInterface.php
  5. +8
    -0
      ShopBundle/Context/CreditHistoryInterface.php
  6. +8
    -0
      ShopBundle/Context/DocumentDeliveryNoteInterface.php
  7. +8
    -0
      ShopBundle/Context/DocumentInvoiceInterface.php
  8. +8
    -0
      ShopBundle/Context/DocumentQuotationInterface.php
  9. +8
    -0
      ShopBundle/Context/MerchantConfigInterface.php
  10. +0
    -4
      ShopBundle/Context/MerchantInterface.php
  11. +8
    -0
      ShopBundle/Context/OrderProductInterface.php
  12. +8
    -0
      ShopBundle/Context/OrderShopInterface.php
  13. +8
    -0
      ShopBundle/Context/OrderStatusHistoryInterface.php
  14. +8
    -0
      ShopBundle/Context/PointSaleDayInfoInterface.php
  15. +8
    -0
      ShopBundle/Context/PointSaleInterface.php
  16. +8
    -0
      ShopBundle/Context/ProductCategoryInterface.php
  17. +8
    -0
      ShopBundle/Context/ProductFamilyInterface.php
  18. +8
    -0
      ShopBundle/Context/ProductInterface.php
  19. +8
    -0
      ShopBundle/Context/TaxRateInterface.php
  20. +0
    -4
      ShopBundle/Context/UserInterface.php
  21. +8
    -0
      ShopBundle/Context/VisitorInterface.php
  22. +110
    -0
      ShopBundle/Model/AbstractDocumentOrder.php
  23. +354
    -0
      ShopBundle/Model/Address.php
  24. +64
    -0
      ShopBundle/Model/Cart.php
  25. +135
    -0
      ShopBundle/Model/CartProduct.php
  26. +108
    -0
      ShopBundle/Model/CreditConfig.php
  27. +134
    -0
      ShopBundle/Model/CreditHistory.php
  28. +55
    -0
      ShopBundle/Model/DocumentDeliveryNote.php
  29. +56
    -0
      ShopBundle/Model/DocumentInvoice.php
  30. +73
    -0
      ShopBundle/Model/DocumentQuotation.php
  31. +166
    -2
      ShopBundle/Model/Merchant.php
  32. +64
    -0
      ShopBundle/Model/MerchantConfig.php
  33. +132
    -0
      ShopBundle/Model/OrderProduct.php
  34. +271
    -0
      ShopBundle/Model/OrderShop.php
  35. +63
    -0
      ShopBundle/Model/OrderStatusHistory.php
  36. +121
    -0
      ShopBundle/Model/PointSale.php
  37. +80
    -0
      ShopBundle/Model/PointSaleDayInfo.php
  38. +132
    -0
      ShopBundle/Model/Product.php
  39. +71
    -0
      ShopBundle/Model/ProductCategory.php
  40. +204
    -0
      ShopBundle/Model/ProductFamily.php
  41. +117
    -4
      ShopBundle/Model/User.php
  42. +79
    -0
      ShopBundle/Model/Visitor.php

+ 8
- 0
ShopBundle/Context/AddressInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface AddressInterface
{

}

+ 8
- 0
ShopBundle/Context/CartInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface CartInterface
{

}

+ 8
- 0
ShopBundle/Context/CartProductInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface CartProductInterface
{

}

+ 8
- 0
ShopBundle/Context/CreditConfigInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface CreditConfigInterface
{

}

+ 8
- 0
ShopBundle/Context/CreditHistoryInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface CreditHistoryInterface
{

}

+ 8
- 0
ShopBundle/Context/DocumentDeliveryNoteInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface DocumentDeliveryNoteInterface
{

}

+ 8
- 0
ShopBundle/Context/DocumentInvoiceInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface DocumentInvoiceInterface
{

}

+ 8
- 0
ShopBundle/Context/DocumentQuotationInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface DocumentQuotationInterface
{

}

+ 8
- 0
ShopBundle/Context/MerchantConfigInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface MerchantConfigInterface
{

}

+ 0
- 4
ShopBundle/Context/MerchantInterface.php Просмотреть файл

@@ -2,10 +2,6 @@

namespace Lc\ShopBundle\Context;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;


interface MerchantInterface
{


+ 8
- 0
ShopBundle/Context/OrderProductInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderProductInterface
{

}

+ 8
- 0
ShopBundle/Context/OrderShopInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderShopInterface
{

}

+ 8
- 0
ShopBundle/Context/OrderStatusHistoryInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface OrderStatusHistoryInterface
{

}

+ 8
- 0
ShopBundle/Context/PointSaleDayInfoInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface PointSaleDayInfoInterface
{

}

+ 8
- 0
ShopBundle/Context/PointSaleInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface PointSaleInterface
{

}

+ 8
- 0
ShopBundle/Context/ProductCategoryInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface ProductCategoryInterface
{

}

+ 8
- 0
ShopBundle/Context/ProductFamilyInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface ProductFamilyInterface
{

}

+ 8
- 0
ShopBundle/Context/ProductInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface ProductInterface
{

}

+ 8
- 0
ShopBundle/Context/TaxRateInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface TaxRateInterface
{

}

+ 0
- 4
ShopBundle/Context/UserInterface.php Просмотреть файл

@@ -2,10 +2,6 @@

namespace Lc\ShopBundle\Context;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;


interface UserInterface
{


+ 8
- 0
ShopBundle/Context/VisitorInterface.php Просмотреть файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context;

interface VisitorInterface
{

}

+ 110
- 0
ShopBundle/Model/AbstractDocumentOrder.php Просмотреть файл

@@ -0,0 +1,110 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass
*/
abstract class AbstractDocumentOrder extends AbstractEntity
{
/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $reference;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\Column(type="text")
*/
protected $address;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;


public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getReference(): ?string
{
return $this->reference;
}

public function setReference(?string $reference): self
{
$this->reference = $reference;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}

public function getAddress(): ?string
{
return $this->address;
}

public function setAddress(string $address): self
{
$this->address = $address;

return $this;
}

public function getOrders(): ?string
{
return $this->orders;
}

public function setOrders(string $orders): self
{
$this->orders = $orders;

return $this;
}

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}
}

+ 354
- 0
ShopBundle/Model/Address.php Просмотреть файл

@@ -0,0 +1,354 @@
<?php

namespace Lc\ShopBundle\Model;

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

/**
* @ORM\MappedSuperclass()
*/
abstract class Address extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="addresses")
* @ORM\JoinColumn(nullable=true)
*/
protected $user;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

/**
* @ORM\Column(type="string", length=31)
*/
protected $type;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $civility;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $lastname;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $firstname;

/**
* @ORM\Column(type="text")
*/
protected $address;

/**
* @ORM\Column(type="string", length=31)
*/
protected $zip;

/**
* @ORM\Column(type="string", length=255)
*/
protected $city;

/**
* @ORM\Column(type="string", length=255)
*/
protected $country;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $company;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $siret;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $tva;

/**
* @ORM\Column(type="string", length=127, nullable=true)
*/
protected $phone;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

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

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $pointSale;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", mappedBy="address", cascade={"persist", "remove"})
*/
protected $merchant;

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

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

public function getCivility(): ?bool
{
return $this->civility;
}

public function setCivility(?bool $civility): self
{
$this->civility = $civility;

return $this;
}

public function getLastname(): ?string
{
return $this->lastname;
}

public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;

return $this;
}

public function getFirstname(): ?string
{
return $this->firstname;
}

public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;

return $this;
}

public function getAddress(): ?string
{
return $this->address;
}

public function setAddress(string $address): self
{
$this->address = $address;

return $this;
}

public function getZip(): ?string
{
return $this->zip;
}

public function setZip(string $zip): self
{
$this->zip = $zip;

return $this;
}

public function getCity(): ?string
{
return $this->city;
}

public function setCity(string $city): self
{
$this->city = $city;

return $this;
}

public function getCountry(): ?string
{
return $this->country;
}

public function setCountry(string $country): self
{
$this->country = $country;

return $this;
}

public function getCompany(): ?string
{
return $this->company;
}

public function setCompany(?string $company): self
{
$this->company = $company;

return $this;
}

public function getSiret(): ?string
{
return $this->siret;
}

public function setSiret(?string $siret): self
{
$this->siret = $siret;

return $this;
}

public function getTva(): ?string
{
return $this->tva;
}

public function setTva(?string $tva): self
{
$this->tva = $tva;

return $this;
}

public function getPhone(): ?string
{
return $this->phone;
}

public function setPhone(?string $phone): self
{
$this->phone = $phone;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}

/**
* @return Collection|ShopOrder[]
*/
public function getOrders(): Collection
{
return $this->orders;
}

public function addOrder(OrderShop $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setInvoiceAddress($this);
}

return $this;
}

public function removeOrder(OrderShop $order): self
{
if ($this->orders->contains($order)) {
$this->orders->removeElement($order);
// set the owning side to null (unless already changed)
if ($order->getInvoiceAddress() === $this) {
$order->setInvoiceAddress(null);
}
}

return $this;
}

public function getPointSale(): ?PointSale
{
return $this->pointSale;
}

public function setPointSale(PointSale $pointSale): self
{
$this->pointSale = $pointSale;

// set the owning side of the relation if necessary
if ($pointSale->getAddress() !== $this) {
$pointSale->setAddress($this);
}

return $this;
}

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(Merchant $merchant): self
{
$this->merchant = $merchant;

// set the owning side of the relation if necessary
if ($merchant->getAddress() !== $this) {
$merchant->setAddress($this);
}

return $this;
}
}

+ 64
- 0
ShopBundle/Model/Cart.php Просмотреть файл

@@ -0,0 +1,64 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class Cart extends AbstractEntity
{
/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\VisitorInterface", inversedBy="cart", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $visitor;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="carts")
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface")
*/
protected $address;


public function getVisitor(): ?Visitor
{
return $this->visitor;
}

public function setVisitor(Visitor $visitor): self
{
$this->visitor = $visitor;

return $this;
}

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getAddress(): ?Address
{
return $this->address;
}

public function setAddress(?Address $address): self
{
$this->address = $address;

return $this;
}
}

+ 135
- 0
ShopBundle/Model/CartProduct.php Просмотреть файл

@@ -0,0 +1,135 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class CartProduct extends AbstractEntity
{

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\CartInterface", inversedBy="cartProducts")
* @ORM\JoinColumn(nullable=false)
*/
protected $cart;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $product;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $taxRate;

/**
* @ORM\Column(type="float")
*/
protected $price;

/**
* @ORM\Column(type="string", length=31)
*/
protected $unit;

/**
* @ORM\Column(type="float")
*/
protected $quantity;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;


public function getCart(): ?Cart
{
return $this->cart;
}

public function setCart(?Cart $cart): self
{
$this->cart = $cart;

return $this;
}

public function getProduct(): ?Product
{
return $this->product;
}

public function setProduct(?Product $product): self
{
$this->product = $product;

return $this;
}

public function getTaxRate(): ?TaxRate
{
return $this->taxRate;
}

public function setTaxRate(?TaxRate $taxRate): self
{
$this->taxRate = $taxRate;

return $this;
}

public function getPrice(): ?float
{
return $this->price;
}

public function setPrice(float $price): self
{
$this->price = $price;

return $this;
}

public function getUnit(): ?string
{
return $this->unit;
}

public function setUnit(string $unit): self
{
$this->unit = $unit;

return $this;
}

public function getQuantity(): ?float
{
return $this->quantity;
}

public function setQuantity(float $quantity): self
{
$this->quantity = $quantity;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}
}

+ 108
- 0
ShopBundle/Model/CreditConfig.php Просмотреть файл

@@ -0,0 +1,108 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class CreditConfig
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;

/**
* @ORM\Column(type="boolean")
*/
private $active;

/**
* @ORM\Column(type="float", nullable=true)
*/
private $limitAmount;

/**
* @ORM\Column(type="float", nullable=true)
*/
private $limitReminder;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
private $behavior;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $processOrderCheckedDefault;

public function getId(): ?int
{
return $this->id;
}

public function getActive(): ?bool
{
return $this->active;
}

public function setActive(bool $active): self
{
$this->active = $active;

return $this;
}

public function getLimitAmount(): ?float
{
return $this->limitAmount;
}

public function setLimitAmount(?float $limitAmount): self
{
$this->limitAmount = $limitAmount;

return $this;
}

public function getLimitReminder(): ?float
{
return $this->limitReminder;
}

public function setLimitReminder(?float $limitReminder): self
{
$this->limitReminder = $limitReminder;

return $this;
}

public function getBehavior(): ?string
{
return $this->behavior;
}

public function setBehavior(?string $behavior): self
{
$this->behavior = $behavior;

return $this;
}

public function getProcessOrderCheckedDefault(): ?bool
{
return $this->processOrderCheckedDefault;
}

public function setProcessOrderCheckedDefault(?bool $processOrderCheckedDefault): self
{
$this->processOrderCheckedDefault = $processOrderCheckedDefault;

return $this;
}
}

+ 134
- 0
ShopBundle/Model/CreditHistory.php Просмотреть файл

@@ -0,0 +1,134 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\OrderShop;
use Doctrine\ORM\Mapping as ORM;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="creditHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;

/**
* @ORM\Column(type="float")
*/
protected $amount;

/**
* @ORM\Column(type="string", length=31)
*/
protected $type;

/**
* @ORM\Column(type="string", length=31)
*/
protected $meanPayment;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="creditHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getAmount(): ?float
{
return $this->amount;
}

public function setAmount(float $amount): self
{
$this->amount = $amount;

return $this;
}

public function getType(): ?string
{
return $this->type;
}

public function setType(string $type): self
{
$this->type = $type;

return $this;
}

public function getMeanPayment(): ?string
{
return $this->meanPayment;
}

public function setMeanPayment(string $meanPayment): self
{
$this->meanPayment = $meanPayment;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(string $comment): self
{
$this->comment = $comment;

return $this;
}

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}
}

+ 55
- 0
ShopBundle/Model/DocumentDeliveryNote.php Просмотреть файл

@@ -0,0 +1,55 @@
<?php

namespace Lc\ShopBundle\Model;

use Lc\ShopBundle\Model\OrderShop;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class DocumentDeliveryNote extends AbstractDocumentOrder
{
/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documentDeliveryNote")
*/
protected $orderShops;

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

/**
* @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->setDocumentDeliveryNote($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->getDocumentDeliveryNote() === $this) {
$orderShop->setDocumentDeliveryNote(null);
}
}

return $this;
}
}

+ 56
- 0
ShopBundle/Model/DocumentInvoice.php Просмотреть файл

@@ -0,0 +1,56 @@
<?php

namespace Lc\ShopBundle\Model;

use Lc\ShopBundle\Model\OrderShop;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class DocumentInvoice extends AbstractDocumentOrder
{
/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documentInvoice")
*/
protected $orderShops;

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

/**
* @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->setDocumentInvoice($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->getDocumentInvoice() === $this) {
$orderShop->setDocumentInvoice(null);
}
}

return $this;
}

}

+ 73
- 0
ShopBundle/Model/DocumentQuotation.php Просмотреть файл

@@ -0,0 +1,73 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\OrderShop;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class DocumentQuotation extends AbstractDocumentOrder
{

/**
* @ORM\Column(type="integer", nullable=true)
*/
protected $duration;

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

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

public function getDuration(): ?int
{
return $this->duration;
}

public function setDuration(?int $duration): self
{
$this->duration = $duration;

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->setDocumentQuotation($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->getDocumentQuotation() === $this) {
$orderShop->setDocumentQuotation(null);
}
}

return $this;
}
}

+ 166
- 2
ShopBundle/Model/Merchant.php Просмотреть файл

@@ -2,14 +2,178 @@

namespace Lc\ShopBundle\Model;

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

/**
* @ORM\MappedSuperclass()
*/

abstract class Merchant extends AbstractDocumentEntity
{
/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\CreditConfigInterface", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $creditConfig;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $taxRate;

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", mappedBy="merchant")
*/
protected $pointSales;

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

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\MerchantConfigInterface", mappedBy="merchant", orphanRemoval=true)
*/
protected $merchantConfigs;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="merchant", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $address;

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

public function getCreditConfig(): ?CreditConfig
{
return $this->creditConfig;
}

public function setCreditConfig(CreditConfig $creditConfig): self
{
$this->creditConfig = $creditConfig;

return $this;
}

public function getTaxRate(): ?TaxRate
{
return $this->taxRate;
}

public function setTaxRate(?TaxRate $taxRate): self
{
$this->taxRate = $taxRate;

return $this;
}

/**
* @return Collection|PointSale[]
*/
public function getPointSales(): Collection
{
return $this->pointSales;
}

public function addPointSale(PointSale $pointSale): self
{
if (!$this->pointSales->contains($pointSale)) {
$this->pointSales[] = $pointSale;
$pointSale->addMerchant($this);
}

return $this;
}

public function removePointSale(PointSale $pointSale): self
{
if ($this->pointSales->contains($pointSale)) {
$this->pointSales->removeElement($pointSale);
$pointSale->removeMerchant($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->setMerchant($this);
}

return $this;
}

public function removeProductFamily(ProductFamily $productFamily): self
{
if ($this->productFamilies->contains($productFamily)) {
$this->productFamilies->removeElement($productFamily);
// set the owning side to null (unless already changed)
if ($productFamily->getMerchant() === $this) {
$productFamily->setMerchant(null);
}
}

return $this;
}

/**
* @return Collection|MerchantConfig[]
*/
public function getMerchantConfigs(): Collection
{
return $this->merchantConfigs;
}

public function addMerchantConfig(MerchantConfig $merchantConfig): self
{
if (!$this->merchantConfigs->contains($merchantConfig)) {
$this->merchantConfigs[] = $merchantConfig;
$merchantConfig->setMerchant($this);
}

return $this;
}

public function removeMerchantConfig(MerchantConfig $merchantConfig): self
{
if ($this->merchantConfigs->contains($merchantConfig)) {
$this->merchantConfigs->removeElement($merchantConfig);
// set the owning side to null (unless already changed)
if ($merchantConfig->getMerchant() === $this) {
$merchantConfig->setMerchant(null);
}
}

return $this;
}

public function getAddress(): ?Address
{
return $this->address;
}

public function setAddress(Address $address): self
{
$this->address = $address;

return $this;
}
}

+ 64
- 0
ShopBundle/Model/MerchantConfig.php Просмотреть файл

@@ -0,0 +1,64 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class MerchantConfig
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="merchantConfigs")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=63)
*/
protected $name;

/**
* @ORM\Column(type="text")
*/
protected $value;


public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getName(): ?string
{
return $this->name;
}

public function setName(string $name): self
{
$this->name = $name;

return $this;
}

public function getValue(): ?string
{
return $this->value;
}

public function setValue(string $value): self
{
$this->value = $value;

return $this;
}
}

+ 132
- 0
ShopBundle/Model/OrderProduct.php Просмотреть файл

@@ -0,0 +1,132 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderProduct extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderProducts")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductInterface")
*/
protected $product;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $taxRate;

/**
* @ORM\Column(type="float")
*/
protected $price;

/**
* @ORM\Column(type="string", length=31)
*/
protected $unit;

/**
* @ORM\Column(type="float")
*/
protected $quantity;

/**
* @ORM\Column(type="string", length=255)
*/
protected $title;

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getProduct(): ?Product
{
return $this->product;
}

public function setProduct(?Product $product): self
{
$this->product = $product;

return $this;
}

public function getTaxRate(): ?TaxRate
{
return $this->taxRate;
}

public function setTaxRate(?TaxRate $taxRate): self
{
$this->taxRate = $taxRate;

return $this;
}

public function getPrice(): ?float
{
return $this->price;
}

public function setPrice(float $price): self
{
$this->price = $price;

return $this;
}

public function getUnit(): ?string
{
return $this->unit;
}

public function setUnit(string $unit): self
{
$this->unit = $unit;

return $this;
}

public function getQuantity(): ?float
{
return $this->quantity;
}

public function setQuantity(float $quantity): self
{
$this->quantity = $quantity;

return $this;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}
}

+ 271
- 0
ShopBundle/Model/OrderShop.php Просмотреть файл

@@ -0,0 +1,271 @@
<?php

namespace Lc\ShopBundle\Model;

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

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderShop extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface", inversedBy="orders")
* @ORM\JoinColumn(nullable=false)
*/
protected $user;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="order")
* @ORM\JoinColumn(nullable=false)
*/
protected $invoiceAddress;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $comment;

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

/**
* @ORM\Column(type="string", length=31)
*/
protected $meanPayment;

/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $tillerSynchronisation;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderStatusHistoryInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $orderStatusHistories;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $orderProducts;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CreditHistoryInterface", mappedBy="orderShop", orphanRemoval=true)
*/
protected $creditHistories;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\DocumentInvoiceInterface", inversedBy="orderShops")
*/
protected $documentInvoice;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\DocumentQuotationInterface", inversedBy="orderShops")
*/
protected $documentQuotation;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\DocumentDeliveryNoteInterface", inversedBy="orderShops")
*/
protected $documentDeliveryNote;

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

public function getUser(): ?User
{
return $this->user;
}

public function setUser(?User $user): self
{
$this->user = $user;

return $this;
}

public function getInvoiceAddress(): ?Address
{
return $this->invoiceAddress;
}

public function setInvoiceAddress(?Address $invoiceAddress): self
{
$this->invoiceAddress = $invoiceAddress;

return $this;
}

public function getComment(): ?string
{
return $this->comment;
}

public function setComment(?string $comment): self
{
$this->comment = $comment;

return $this;
}

public function getAutoPayment(): ?bool
{
return $this->autoPayment;
}

public function setAutoPayment(bool $autoPayment): self
{
$this->autoPayment = $autoPayment;

return $this;
}

public function getMeanPayment(): ?string
{
return $this->meanPayment;
}

public function setMeanPayment(string $meanPayment): self
{
$this->meanPayment = $meanPayment;

return $this;
}

/**
* @return Collection|OrderStatusHistory[]
*/
public function getOrderStatusHistories(): Collection
{
return $this->orderStatusHistories;
}

public function addOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
{
if (!$this->orderStatusHistories->contains($orderStatusHistory)) {
$this->orderStatusHistories[] = $orderStatusHistory;
$orderStatusHistory->setOrderShop($this);
}

return $this;
}

public function removeOrderStatusHistory(OrderStatusHistory $orderStatusHistory): self
{
if ($this->orderStatusHistories->contains($orderStatusHistory)) {
$this->orderStatusHistories->removeElement($orderStatusHistory);
// set the owning side to null (unless already changed)
if ($orderStatusHistory->getOrderShop() === $this) {
$orderStatusHistory->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|OrderProduct[]
*/
public function getOrderProducts(): Collection
{
return $this->orderProducts;
}

public function addOrderProduct(OrderProduct $orderProduct): self
{
if (!$this->orderProducts->contains($orderProduct)) {
$this->orderProducts[] = $orderProduct;
$orderProduct->setOrderShop($this);
}

return $this;
}

public function removeOrderProduct(OrderProduct $orderProduct): self
{
if ($this->orderProducts->contains($orderProduct)) {
$this->orderProducts->removeElement($orderProduct);
// set the owning side to null (unless already changed)
if ($orderProduct->getOrderShop() === $this) {
$orderProduct->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|CreditHistory[]
*/
public function getCreditHistories(): Collection
{
return $this->creditHistories;
}

public function addCreditHistory(CreditHistory $creditHistory): self
{
if (!$this->creditHistories->contains($creditHistory)) {
$this->creditHistories[] = $creditHistory;
$creditHistory->setOrderShop($this);
}

return $this;
}

public function removeCreditHistory(CreditHistory $creditHistory): self
{
if ($this->creditHistories->contains($creditHistory)) {
$this->creditHistories->removeElement($creditHistory);
// set the owning side to null (unless already changed)
if ($creditHistory->getOrderShop() === $this) {
$creditHistory->setOrderShop(null);
}
}

return $this;
}

public function getDocumentInvoice(): ?DocumentInvoice
{
return $this->documentInvoice;
}

public function setDocumentInvoice(?DocumentInvoice $documentInvoice): self
{
$this->documentInvoice = $documentInvoice;

return $this;
}

public function getDocumentQuotation(): ?DocumentQuotation
{
return $this->documentQuotation;
}

public function setDocumentQuotation(?DocumentQuotation $documentQuotation): self
{
$this->documentQuotation = $documentQuotation;

return $this;
}

public function getDocumentDeliveryNote(): ?DocumentDeliveryNote
{
return $this->documentDeliveryNote;
}

public function setDocumentDeliveryNote(?DocumentDeliveryNote $documentDeliveryNote): self
{
$this->documentDeliveryNote = $documentDeliveryNote;

return $this;
}
}

+ 63
- 0
ShopBundle/Model/OrderStatusHistory.php Просмотреть файл

@@ -0,0 +1,63 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderStatusHistory extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderStatusHistories")
* @ORM\JoinColumn(nullable=false)
*/
protected $orderShop;

/**
* @ORM\Column(type="string", length=31)
*/
protected $orderStatus;

/**
* @ORM\Column(type="string", length=31)
*/
protected $origin;

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;
}

public function setOrderShop(?OrderShop $orderShop): self
{
$this->orderShop = $orderShop;

return $this;
}

public function getOrderStatus(): ?string
{
return $this->orderStatus;
}

public function setOrderStatus(string $orderStatus): self
{
$this->orderStatus = $orderStatus;

return $this;
}

public function getOrigin(): ?string
{
return $this->origin;
}

public function setOrigin(string $origin): self
{
$this->origin = $origin;

return $this;
}
}

+ 121
- 0
ShopBundle/Model/PointSale.php Просмотреть файл

@@ -0,0 +1,121 @@
<?php

namespace Lc\ShopBundle\Model;

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

/**
* @ORM\MappedSuperclass()
*/
abstract class PointSale extends AbstractDocumentEntity
{
/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pointSales")
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=63, nullable=true)
*/
protected $code;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\PointSaleDayInfoInterface", mappedBy="pointSale", orphanRemoval=true)
*/
protected $pointSaleDayInfos;

/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\AddressInterface", inversedBy="pointSale", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
protected $address;

public function __construct()
{
$this->merchant = new ArrayCollection();
$this->pointSaleDayInfos = new ArrayCollection();
}

/**
* @return Collection|Merchant[]
*/
public function getMerchant(): Collection
{
return $this->merchant;
}

public function addMerchant(Merchant $merchant): self
{
if (!$this->merchant->contains($merchant)) {
$this->merchant[] = $merchant;
}

return $this;
}

public function removeMerchant(Merchant $merchant): self
{
if ($this->merchant->contains($merchant)) {
$this->merchant->removeElement($merchant);
}

return $this;
}

public function getCode(): ?string
{
return $this->code;
}

public function setCode(?string $code): self
{
$this->code = $code;

return $this;
}

/**
* @return Collection|PointSaleDayInfo[]
*/
public function getPointSaleDayInfos(): Collection
{
return $this->pointSaleDayInfos;
}

public function addPointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
{
if (!$this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
$this->pointSaleDayInfos[] = $pointSaleDayInfo;
$pointSaleDayInfo->setPointSale($this);
}

return $this;
}

public function removePointSaleDayInfo(PointSaleDayInfo $pointSaleDayInfo): self
{
if ($this->pointSaleDayInfos->contains($pointSaleDayInfo)) {
$this->pointSaleDayInfos->removeElement($pointSaleDayInfo);
// set the owning side to null (unless already changed)
if ($pointSaleDayInfo->getPointSale() === $this) {
$pointSaleDayInfo->setPointSale(null);
}
}

return $this;
}

public function getAddress(): ?Address
{
return $this->address;
}

public function setAddress(Address $address): self
{
$this->address = $address;

return $this;
}
}

+ 80
- 0
ShopBundle/Model/PointSaleDayInfo.php Просмотреть файл

@@ -0,0 +1,80 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class PointSaleDayInfo extends AbstractEntity
{
/**
* @ORM\Column(type="boolean")
*/
protected $active;

/**
* @ORM\Column(type="smallint")
*/
protected $day;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $description;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\PointSaleInterface", inversedBy="pointSaleDayInfos")
* @ORM\JoinColumn(nullable=false)
*/
protected $pointSale;

public function getActive(): ?bool
{
return $this->active;
}

public function setActive(bool $active): self
{
$this->active = $active;

return $this;
}

public function getDay(): ?int
{
return $this->day;
}

public function setDay(int $day): self
{
$this->day = $day;

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(?string $description): self
{
$this->description = $description;

return $this;
}

public function getPointSale(): ?PointSale
{
return $this->pointSale;
}

public function setPointSale(?PointSale $pointSale): self
{
$this->pointSale = $pointSale;

return $this;
}
}

+ 132
- 0
ShopBundle/Model/Product.php Просмотреть файл

@@ -0,0 +1,132 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class Product extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductFamilyInterface", inversedBy="products")
* @ORM\JoinColumn(nullable=false)
*/
protected $productFamily;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $price;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
protected $unit;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $step;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $weight;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $availableQuantity;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $stock;


public function getProductFamily(): ?ProductFamily
{
return $this->productFamily;
}

public function setProductFamily(?ProductFamily $productFamily): self
{
$this->productFamily = $productFamily;

return $this;
}

public function getPrice(): ?float
{
return $this->price;
}

public function setPrice(?float $price): self
{
$this->price = $price;

return $this;
}

public function getUnit(): ?string
{
return $this->unit;
}

public function setUnit(?string $unit): self
{
$this->unit = $unit;

return $this;
}

public function getStep(): ?float
{
return $this->step;
}

public function setStep(?float $step): self
{
$this->step = $step;

return $this;
}

public function getWeight(): ?float
{
return $this->weight;
}

public function setWeight(?float $weight): self
{
$this->weight = $weight;

return $this;
}

public function getAvailableQuantity(): ?float
{
return $this->availableQuantity;
}

public function setAvailableQuantity(?float $availableQuantity): self
{
$this->availableQuantity = $availableQuantity;

return $this;
}

public function getStock(): ?float
{
return $this->stock;
}

public function setStock(?float $stock): self
{
$this->stock = $stock;

return $this;
}
}

+ 71
- 0
ShopBundle/Model/ProductCategory.php Просмотреть файл

@@ -0,0 +1,71 @@
<?php

namespace Lc\ShopBundle\Model;

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

/**
* @ORM\MappedSuperclass()
*/
abstract class ProductCategory extends AbstractDocumentEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", inversedBy="productCategories")
*/
protected $productCategory;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\ProductCategoryInterface", mappedBy="productCategory")
*/
protected $productCategories;

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

public function getProductCategory(): ?self
{
return $this->productCategory;
}

public function setProductCategory(?self $productCategory): self
{
$this->productCategory = $productCategory;

return $this;
}

/**
* @return Collection|self[]
*/
public function getProductCategories(): Collection
{
return $this->productCategories;
}

public function addProductCategory(self $productCategory): self
{
if (!$this->productCategories->contains($productCategory)) {
$this->productCategories[] = $productCategory;
$productCategory->setProductCategory($this);
}

return $this;
}

public function removeProductCategory(self $productCategory): self
{
if ($this->productCategories->contains($productCategory)) {
$this->productCategories->removeElement($productCategory);
// set the owning side to null (unless already changed)
if ($productCategory->getProductCategory() === $this) {
$productCategory->setProductCategory(null);
}
}

return $this;
}
}

+ 204
- 0
ShopBundle/Model/ProductFamily.php Просмотреть файл

@@ -0,0 +1,204 @@
<?php

namespace Lc\ShopBundle\Model;

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

/**
* @ORM\MappedSuperclass()
*/
abstract class ProductFamily extends AbstractDocumentEntity
{
/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="productFamilies")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

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

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $taxRate;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $price;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
protected $unit;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $step;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $stock;

/**
* @ORM\Column(type="float", nullable=true)
*/
protected $availableQuantity;

/**
* @ORM\Column(type="string", length=31, nullable=true)
*/
protected $behaviorOutOfStock;

/**
* @ORM\Column(type="string", length=31)
*/
protected $behaviorCountStock;

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

public function getMerchant(): ?Merchant
{
return $this->merchant;
}

public function setMerchant(?Merchant $merchant): self
{
$this->merchant = $merchant;

return $this;
}

/**
* @return Collection|ProductCategory[]
*/
public function getProductCategory(): Collection
{
return $this->productCategory;
}

public function addProductCategory(ProductCategory $productCategory): self
{
if (!$this->productCategory->contains($productCategory)) {
$this->productCategory[] = $productCategory;
}

return $this;
}

public function removeProductCategory(ProductCategory $productCategory): self
{
if ($this->productCategory->contains($productCategory)) {
$this->productCategory->removeElement($productCategory);
}

return $this;
}

public function getTaxRate(): ?TaxRate
{
return $this->taxRate;
}

public function setTaxRate(?TaxRate $taxRate): self
{
$this->taxRate = $taxRate;

return $this;
}

public function getUnit(): ?string
{
return $this->unit;
}

public function setUnit(?string $unit): self
{
$this->unit = $unit;

return $this;
}

public function getPrice(): ?float
{
return $this->price;
}

public function setPrice(?float $price): self
{
$this->price = $price;

return $this;
}

public function getStep(): ?float
{
return $this->price;
}

public function setStep(?float $price): self
{
$this->price = $price;

return $this;
}

public function getStock(): ?float
{
return $this->stock;
}

public function setStock(?float $stock): self
{
$this->stock = $stock;

return $this;
}

public function getAvailableQuantity(): ?float
{
return $this->availableQuantity;
}

public function setAvailableQuantity(?float $availableQuantity): self
{
$this->availableQuantity = $availableQuantity;

return $this;
}

public function getBehaviorOutOfStock(): ?string
{
return $this->behaviorOutOfStock;
}

public function setBehaviorOutOfStock(?string $behaviorOutOfStock): self
{
$this->behaviorOutOfStock = $behaviorOutOfStock;

return $this;
}

public function getBehaviorCountStock(): ?string
{
return $this->behaviorCountStock;
}

public function setBehaviorCountStock(string $behaviorCountStock): self
{
$this->behaviorCountStock = $behaviorCountStock;

return $this;
}
}

+ 117
- 4
ShopBundle/Model/User.php Просмотреть файл

@@ -2,6 +2,8 @@

namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as UserModelFOS;
use Lc\ShopBundle\Context\MerchantInterface;
@@ -11,7 +13,6 @@ use Lc\ShopBundle\Context\MerchantInterface;
*/
abstract class User //extends UserModelFOS
{

/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
@@ -27,6 +28,27 @@ abstract class User //extends UserModelFOS
*/
protected $merchant;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\CreditHistoryInterface", mappedBy="user", orphanRemoval=true)
*/
private $creditHistories;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\AddressInterface", mappedBy="user")
*/
private $addresses;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="user")
*/
private $orders;

public function __construct()
{
$this->creditHistories = new ArrayCollection();
$this->addresses = new ArrayCollection();
$this->orders = new ArrayCollection();
}

public function getPhone(): ?string
{
@@ -54,15 +76,106 @@ abstract class User //extends UserModelFOS

public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;
$this->merchant = $merchant;

return $this;
}

/**
* @return Collection|CreditHistory[]
*/
public function getCreditHistories(): Collection
{
return $this->creditHistories;
}

public function addCreditHistory(CreditHistory $creditHistory): self
{
if (!$this->creditHistories->contains($creditHistory)) {
$this->creditHistories[] = $creditHistory;
$creditHistory->setUser($this);
}

return $this;
}

public function removeCreditHistory(CreditHistory $creditHistory): self
{
if ($this->creditHistories->contains($creditHistory)) {
$this->creditHistories->removeElement($creditHistory);
// set the owning side to null (unless already changed)
if ($creditHistory->getUser() === $this) {
$creditHistory->setUser(null);
}
}

return $this;
}

/**
* @return Collection|Address[]
*/
public function getAddresses(): Collection
{
return $this->addresses;
}

public function addAddress(Address $address): self
{
if (!$this->addresses->contains($address)) {
$this->addresses[] = $address;
$address->setUser($this);
}

return $this;
}

public function removeAddress(Address $address): self
{
if ($this->addresses->contains($address)) {
$this->addresses->removeElement($address);
// set the owning side to null (unless already changed)
if ($address->getUser() === $this) {
$address->setUser(null);
}
}

return $this;
return $this;
}

/**
* @return Collection|ShopOrder[]
*/
public function getOrders(): Collection
{
return $this->orders;
}

public function addOrder(OrderShop $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setUser($this);
}

return $this;
}

public function removeOrder(OrderShop $order): self
{
if ($this->orders->contains($order)) {
$this->orders->removeElement($order);
// set the owning side to null (unless already changed)
if ($order->getUser() === $this) {
$order->setUser(null);
}
}

return $this;
}
}

+ 79
- 0
ShopBundle/Model/Visitor.php Просмотреть файл

@@ -0,0 +1,79 @@
<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\MappedSuperclass()
*/
abstract class Visitor
{
/**
* @ORM\Column(type="string", length=255)
*/
protected $cookie;

/**
* @ORM\Column(type="datetime")
*/
protected $lastAccess;

/**
* @ORM\Column(type="string", length=255)
*/
protected $ip;

/**
* @ORM\Column(type="integer")
*/
protected $totalVisit;

public function getCookie(): ?string
{
return $this->cookie;
}

public function setCookie(?string $cookie): self
{
$this->cookie = $cookie;

return $this;
}

public function getLastAccess(): ?\DateTimeInterface
{
return $this->lastAccess;
}

public function setLastAccess(\DateTimeInterface $lastAccess): self
{
$this->lastAccess = $lastAccess;

return $this;
}

public function getIp(): ?string
{
return $this->ip;
}

public function setIp(?string $ip): self
{
$this->ip = $ip;

return $this;
}

public function getTotalVisit(): ?int
{
return $this->totalVisit;
}

public function setTotalVisit(int $totalVisit): self
{
$this->totalVisit = $totalVisit;

return $this;
}
}

Загрузка…
Отмена
Сохранить