src/Entity/TaxRecord.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TaxRecordRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6. * @ORM\Entity(repositoryClass=TaxRecordRepository::class)
  7. */
  8. class TaxRecord
  9. {
  10. /**
  11. * @ORM\Id
  12. * @ORM\GeneratedValue
  13. * @ORM\Column(type="integer")
  14. */
  15. private $id;
  16. /**
  17. * @ORM\Column(type="float")
  18. */
  19. private $amt;
  20. /**
  21. * @ORM\Column(type="datetime_immutable")
  22. */
  23. private $createdAt;
  24. /**
  25. * @ORM\ManyToOne(targetEntity=Tax::class)
  26. */
  27. private $tax;
  28. /**
  29. * @ORM\ManyToOne(targetEntity=Transaction::class, inversedBy="taxRecords", cascade={"persist"})
  30. */
  31. private $transaction;
  32. public function __construct()
  33. {
  34. if($this->amt) $this->amt = number_format($this->amt, 2);
  35. }
  36. public function getId(): ?int
  37. {
  38. return $this->id;
  39. }
  40. public function getAmt(): ?float
  41. {
  42. return $this->amt;
  43. }
  44. public function setAmt(float $amt): self
  45. {
  46. $this->amt = $amt;
  47. return $this;
  48. }
  49. public function getCreatedAt(): ?\DateTimeImmutable
  50. {
  51. return $this->createdAt;
  52. }
  53. public function setCreatedAt(\DateTimeImmutable $createdAt): self
  54. {
  55. $this->createdAt = $createdAt;
  56. return $this;
  57. }
  58. public function getTax(): ?Tax
  59. {
  60. return $this->tax;
  61. }
  62. public function setTax(?Tax $tax): self
  63. {
  64. $this->tax = $tax;
  65. return $this;
  66. }
  67. public function getTransaction(): ?Transaction
  68. {
  69. return $this->transaction;
  70. }
  71. public function setTransaction(?Transaction $transaction): self
  72. {
  73. $this->transaction = $transaction;
  74. return $this;
  75. }
  76. public function __toString()
  77. {
  78. return $this->getTax()->getContent() .': ' . $this->getAmt();
  79. }
  80. }