src/Entity/PointTransactionImportHistory.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PointTransactionImportHistoryRepository;
  4. use App\Traits\DateTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ORM\Entity(repositoryClass=PointTransactionImportHistoryRepository::class)
  10. */
  11. class PointTransactionImportHistory
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", length=255, nullable=true)
  21. */
  22. private $fileName;
  23. /**
  24. * @ORM\ManyToOne(targetEntity=User::class)
  25. * @ORM\JoinColumn(nullable=false)
  26. */
  27. private $admin;
  28. /**
  29. * @ORM\Column(type="string", length=255)
  30. */
  31. private $type;
  32. /**
  33. * @ORM\OneToMany(targetEntity=PointTransaction::class, mappedBy="importHistory")
  34. */
  35. private $pointTransactions;
  36. public function __construct()
  37. {
  38. $this->pointTransactions = new ArrayCollection();
  39. }
  40. use DateTrait;
  41. public function getId(): int
  42. {
  43. return $this->id;
  44. }
  45. public function getFileName(): ?string
  46. {
  47. return $this->fileName;
  48. }
  49. public function setFileName( ?string $fileName ): self
  50. {
  51. $this->fileName = $fileName;
  52. return $this;
  53. }
  54. public function getAdmin(): User
  55. {
  56. return $this->admin;
  57. }
  58. public function setAdmin( User $admin ): self
  59. {
  60. $this->admin = $admin;
  61. return $this;
  62. }
  63. public function getType(): ?string
  64. {
  65. return $this->type;
  66. }
  67. public function setType( string $type ): self
  68. {
  69. $this->type = $type;
  70. return $this;
  71. }
  72. /**
  73. * @return Collection|PointTransaction[]
  74. */
  75. public function getPointTransactions(): Collection
  76. {
  77. return $this->pointTransactions;
  78. }
  79. public function addPointTransaction( PointTransaction $pointTransaction ): self
  80. {
  81. if ( !$this->pointTransactions->contains( $pointTransaction ) ) {
  82. $this->pointTransactions[] = $pointTransaction;
  83. $pointTransaction->setImportHistory( $this );
  84. }
  85. return $this;
  86. }
  87. public function removePointTransaction( PointTransaction $pointTransaction ): self
  88. {
  89. if ( $this->pointTransactions->removeElement( $pointTransaction ) ) {
  90. // set the owning side to null (unless already changed)
  91. if ( $pointTransaction->getImportHistory() === $this ) {
  92. $pointTransaction->setImportHistory( NULL );
  93. }
  94. }
  95. return $this;
  96. }
  97. }