src/Entity/System/OrderInvoiceCustomer.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * Class OrderInvoiceCustomer
  6. *
  7. * @ORM\Table(name="ps_order_invoices_customer")
  8. *
  9. * @ORM\Entity(repositoryClass="App\Repository\System\OrderInvoiceCustomerRepository")
  10. */
  11. class OrderInvoiceCustomer
  12. {
  13. /**
  14. * @var int
  15. *
  16. * @ORM\Id()
  17. *
  18. * @ORM\GeneratedValue()
  19. *
  20. * @ORM\Column(type="integer", name="id_order_invoice_customer")
  21. */
  22. private $id;
  23. /**
  24. * @var Order
  25. *
  26. * @ORM\ManyToOne(targetEntity="App\Entity\System\Order")
  27. *
  28. * @ORM\JoinColumn(name="id_order", referencedColumnName="id_order", nullable=false)
  29. */
  30. private $order;
  31. /**
  32. * @var OrderInvoiceCustomerDetail|null
  33. *
  34. * @ORM\OneToOne(targetEntity="App\Entity\System\OrderInvoiceCustomerDetail", inversedBy="orderInvoiceCustomer", cascade={"persist"})
  35. *
  36. * @ORM\JoinColumn(name="detail_id", referencedColumnName="id", nullable=true)
  37. */
  38. private ?OrderInvoiceCustomerDetail $detail;
  39. /**
  40. * @var string
  41. *
  42. * @ORM\Column(type="string", length=100)
  43. */
  44. private $fileName;
  45. /**
  46. * @var string
  47. *
  48. * @ORM\Column(type="string", length=255, options={"default": ""})
  49. */
  50. private $concept;
  51. /**
  52. * @var \DateTime
  53. *
  54. * @ORM\Column(type="datetime")
  55. */
  56. private $dateUploaded;
  57. /**
  58. * @var float
  59. *
  60. * @ORM\Column(type="float", name="importe_factura", nullable=true)
  61. */
  62. private $invoiceAmount;
  63. public static function createFromValues(Order $order, string $fileName, string $concept, float $invoiceAmount): OrderInvoiceCustomer
  64. {
  65. $invoice = new self();
  66. $invoice->order = $order;
  67. $invoice->fileName = $fileName;
  68. $invoice->concept = $concept;
  69. $invoice->dateUploaded = new \DateTime();
  70. $invoice->invoiceAmount = $invoiceAmount;
  71. return $invoice;
  72. }
  73. /**
  74. * @param Order $order
  75. * @param string $fileName
  76. * @param string $concept
  77. * @param float $invoiceAmount
  78. */
  79. public function setValues(Order $order, string $fileName, string $concept, float $invoiceAmount): void
  80. {
  81. $this->order = $order;
  82. $this->fileName = $fileName;
  83. $this->concept = $concept;
  84. $this->dateUploaded = new \DateTime();
  85. $this->invoiceAmount = $invoiceAmount;
  86. }
  87. /**
  88. * @return int
  89. */
  90. public function getId(): int
  91. {
  92. return $this->id;
  93. }
  94. /**
  95. * @return \DateTime
  96. */
  97. public function getDateUploaded(): \DateTime
  98. {
  99. return $this->dateUploaded;
  100. }
  101. /**
  102. * @return Order
  103. */
  104. public function getOrder(): Order
  105. {
  106. return $this->order;
  107. }
  108. /**
  109. * @return string
  110. */
  111. public function getFileName(): string
  112. {
  113. return $this->fileName;
  114. }
  115. public function getInvoiceAmount(): float
  116. {
  117. return $this->invoiceAmount;
  118. }
  119. public function getDetail(): ?OrderInvoiceCustomerDetail
  120. {
  121. return $this->detail;
  122. }
  123. public function setDetail(?OrderInvoiceCustomerDetail $detail): void
  124. {
  125. $this->detail = $detail;
  126. }
  127. }