src/Entity/Transaction.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TransactionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TransactionRepository::class)
  9.  */
  10. class Transaction
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="float")
  20.      */
  21.     private $amt;
  22.     /**
  23.      * @ORM\Column(type="datetime_immutable")
  24.      */
  25.     private $createdAt;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=PaymentMethod::class)
  28.      */
  29.     private $paymentMethod;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $nota;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=Orden::class, inversedBy="transactions", cascade={"persist"})
  36.      */
  37.     private $orden;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=TaxRecord::class, mappedBy="transaction")
  40.      */
  41.     private $taxRecords;
  42.     public function __construct()
  43.     {
  44.         $this->taxRecords = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function __toString()
  51.     {
  52.         return $this->getOrden() . ': ' $this->getAmt();
  53.     }
  54.     public function getAmt(): ?float
  55.     {
  56.         return $this->amt;
  57.     }
  58.     public function setAmt(float $amt): self
  59.     {
  60.         $this->amt $amt;
  61.         return $this;
  62.     }
  63.     public function getCreatedAt(): ?\DateTimeImmutable
  64.     {
  65.         return $this->createdAt;
  66.     }
  67.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  68.     {
  69.         $this->createdAt $createdAt;
  70.         return $this;
  71.     }
  72.     public function getPaymentMethod(): ?PaymentMethod
  73.     {
  74.         return $this->paymentMethod;
  75.     }
  76.     public function setPaymentMethod(?PaymentMethod $paymentMethod): self
  77.     {
  78.         $this->paymentMethod $paymentMethod;
  79.         return $this;
  80.     }
  81.     public function getNota(): ?string
  82.     {
  83.         return $this->nota;
  84.     }
  85.     public function setNota(?string $nota): self
  86.     {
  87.         $this->nota $nota;
  88.         return $this;
  89.     }
  90.     public function getOrden(): ?Orden
  91.     {
  92.         return $this->orden;
  93.     }
  94.     public function setOrden(?Orden $orden): self
  95.     {
  96.         $this->orden $orden;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, TaxRecord>
  101.      */
  102.     public function getTaxRecords(): Collection
  103.     {
  104.         return $this->taxRecords;
  105.     }
  106.     public function addTaxRecord(TaxRecord $taxRecord): self
  107.     {
  108.         if (!$this->taxRecords->contains($taxRecord)) {
  109.             $this->taxRecords[] = $taxRecord;
  110.             $taxRecord->setTransaction($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeTaxRecord(TaxRecord $taxRecord): self
  115.     {
  116.         if ($this->taxRecords->removeElement($taxRecord)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($taxRecord->getTransaction() === $this) {
  119.                 $taxRecord->setTransaction(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124. }