122 líneas
2.7KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Lc\ShopBundle\Context\OrderPaymentInterface;
  5. use Lc\ShopBundle\Context\ReductionInterface;
  6. /**
  7. * @ORM\MappedSuperclass()
  8. */
  9. abstract class OrderPayment extends AbstractEntity
  10. {
  11. const TYPE_CREDIT_CARD = 'cb' ;
  12. const TYPE_CHEQUE = 'cheque' ;
  13. const TYPE_CREDIT = 'credit' ;
  14. /**
  15. * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="orderPayments")
  16. * @ORM\JoinColumn(nullable=false)
  17. */
  18. protected $orderShop;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. protected $type;
  23. /**
  24. * @ORM\Column(type="text", nullable=true)
  25. */
  26. protected $reference;
  27. /**
  28. * @ORM\Column(type="datetime")
  29. */
  30. protected $paidAt;
  31. /**
  32. * @ORM\Column(type="float")
  33. */
  34. protected $amount;
  35. /**
  36. * @ORM\Column(type="text", nullable=true)
  37. */
  38. protected $comment;
  39. public function __toString()
  40. {
  41. return $this->amount. '€ par '.$this->type.' le '.$this->getPaidAt()->format('d-m-Y');
  42. }
  43. public function getOrderShop(): ?OrderShop
  44. {
  45. return $this->orderShop;
  46. }
  47. public function setOrderShop(?OrderShop $orderShop): self
  48. {
  49. $this->orderShop = $orderShop;
  50. return $this;
  51. }
  52. public function setType(string $type): self
  53. {
  54. $this->type = $type;
  55. return $this;
  56. }
  57. public function getReference(): ?string
  58. {
  59. return $this->reference;
  60. }
  61. public function setReference(?string $reference): self
  62. {
  63. $this->reference = $reference;
  64. return $this;
  65. }
  66. public function getPaidAt(): ?\DateTimeInterface
  67. {
  68. return $this->paidAt;
  69. }
  70. public function setPaidAt(\DateTimeInterface $paidAt): self
  71. {
  72. $this->paidAt = $paidAt;
  73. return $this;
  74. }
  75. public function getAmount(): ?float
  76. {
  77. return $this->amount;
  78. }
  79. public function setAmount(float $amount): self
  80. {
  81. $this->amount = $amount;
  82. return $this;
  83. }
  84. public function getComment(): ?string
  85. {
  86. return $this->comment;
  87. }
  88. public function setComment(?string $comment): self
  89. {
  90. $this->comment = $comment;
  91. return $this;
  92. }
  93. }