You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 satır
3.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Model\Credit;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Lc\CaracoleBundle\Doctrine\Extension\PayoffTrait;
  5. use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
  6. use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface;
  7. use Lc\CaracoleBundle\Model\Order\OrderRefundInterface;
  8. use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface;
  9. use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
  12. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  13. /**
  14. * @ORM\MappedSuperclass()
  15. */
  16. abstract class CreditHistoryModel extends AbstractLightEntity implements PayoffInterface, CreditHistoryInterface
  17. {
  18. use PayoffTrait;
  19. const TYPE_CREDIT = 'credit';
  20. const TYPE_DEBIT = 'debit';
  21. /**
  22. * @ORM\Column(type="float", nullable=true)
  23. */
  24. protected $amount;
  25. /**
  26. * @ORM\Column(type="string", length=31)
  27. */
  28. protected $type;
  29. /**
  30. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories")
  31. * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  32. */
  33. protected $userMerchant;
  34. /**
  35. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
  36. * @ORM\JoinColumn(nullable=false)
  37. */
  38. protected $merchant;
  39. /**
  40. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderPaymentInterface", cascade={"persist"})
  41. */
  42. protected $orderPayment;
  43. /**
  44. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", cascade={"persist"})
  45. */
  46. protected $orderRefund;
  47. public function __toString()
  48. {
  49. //Todo a écrire
  50. return $this->getType();
  51. }
  52. public function getAmount(): ?float
  53. {
  54. return $this->amount;
  55. }
  56. public function setAmount(?float $amount): self
  57. {
  58. $this->amount = $amount;
  59. return $this;
  60. }
  61. public function getType(): ?string
  62. {
  63. return $this->type;
  64. }
  65. public function setType(string $type): self
  66. {
  67. $this->type = $type;
  68. return $this;
  69. }
  70. public function getUserMerchant(): ?UserMerchantInterface
  71. {
  72. return $this->userMerchant;
  73. }
  74. public function setUserMerchant(?UserMerchantInterface $userMerchant): self
  75. {
  76. $this->userMerchant = $userMerchant;
  77. return $this;
  78. }
  79. public function getMerchant(): MerchantInterface
  80. {
  81. return $this->merchant;
  82. }
  83. public function setMerchant(MerchantInterface $merchant): self
  84. {
  85. $this->merchant = $merchant;
  86. return $this;
  87. }
  88. public function getOrderPayment(): ?OrderPaymentInterface
  89. {
  90. return $this->orderPayment;
  91. }
  92. public function setOrderPayment(?OrderPaymentInterface $orderPayment): self
  93. {
  94. $this->orderPayment = $orderPayment;
  95. return $this;
  96. }
  97. public function getOrderRefund(): ?OrderRefundInterface
  98. {
  99. return $this->orderRefund;
  100. }
  101. public function setOrderRefund(?OrderRefundInterface $orderRefund): self
  102. {
  103. $this->orderRefund = $orderRefund;
  104. return $this;
  105. }
  106. }