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

Processus de commandes

feature/export_comptable
Fab 4 лет назад
Родитель
Сommit
41d609084a
4 измененных файлов: 185 добавлений и 0 удалений
  1. +8
    -0
      ShopBundle/Context/OrderPaymentInterface.php
  2. +118
    -0
      ShopBundle/Model/OrderPayment.php
  3. +37
    -0
      ShopBundle/Model/OrderShop.php
  4. +22
    -0
      ShopBundle/Repository/OrderPaymentRepository.php

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

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

namespace Lc\ShopBundle\Context ;

interface OrderPaymentInterface
{

}

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

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

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\ReductionInterface;

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

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

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

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

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

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

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


public function __toString()
{
return 'Par : '.$this->type.' le : '.$this->getPaidAt()->format('d-m-Y H:i');
}

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

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

return $this;
}

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

return $this;
}

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

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

return $this;
}

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

public function setPaidAt(\DateTimeInterface $paidAt): self
{
$this->paidAt = $paidAt;

return $this;
}

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

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

return $this;
}

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

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

return $this;
}
}

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

@@ -60,6 +60,11 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
*/
protected $orderStatusHistories;

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

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\OrderProductInterface", mappedBy="orderShop", cascade={"persist", "remove"}, orphanRemoval=true)
*/
@@ -113,6 +118,7 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
public function __construct()
{
$this->orderStatusHistories = new ArrayCollection();
$this->orderPayments = new ArrayCollection();
$this->orderProducts = new ArrayCollection();
$this->creditHistories = new ArrayCollection();
$this->orderReductionCarts = new ArrayCollection();
@@ -259,6 +265,37 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
return $this;
}

/**
* @return Collection|OrderPayment[]
*/
public function getOrderPayments(): Collection
{
return $this->orderPayments;
}

public function addOrderPayment(OrderPayment $orderPayment): self
{
if (!$this->orderPayments->contains($orderPayment)) {
$this->orderPayments[] = $orderPayment;
$orderPayment->setOrderShop($this);
}

return $this;
}

public function removeOrderPayment(OrderPayment $orderPayment): self
{
if ($this->orderPayments->contains($orderPayment)) {
$this->orderPayments->removeElement($orderPayment);
// set the owning side to null (unless already changed)
if ($orderPayment->getOrderShop() === $this) {
$orderPayment->setOrderShop(null);
}
}

return $this;
}

/**
* @return Collection|OrderProduct[]
*/

+ 22
- 0
ShopBundle/Repository/OrderPaymentRepository.php Просмотреть файл

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

namespace Lc\ShopBundle\Repository;

use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\OrderPaymentInterface;
use Lc\ShopBundle\Context\OrderStatusInterface;

/**
* @method OrderPaymentInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method OrderPaymentInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method OrderPaymentInterface[] findAll()
* @method OrderPaymentInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class OrderPaymentRepository extends BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return OrderPaymentInterface::class;
}

}

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