<?phpnamespace App\Entity;use App\Repository\TransactionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=TransactionRepository::class) */class Transaction{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="float") */ private $amt; /** * @ORM\Column(type="datetime_immutable") */ private $createdAt; /** * @ORM\ManyToOne(targetEntity=PaymentMethod::class) */ private $paymentMethod; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $nota; /** * @ORM\ManyToOne(targetEntity=Orden::class, inversedBy="transactions", cascade={"persist"}) */ private $orden; /** * @ORM\OneToMany(targetEntity=TaxRecord::class, mappedBy="transaction") */ private $taxRecords; public function __construct() { $this->taxRecords = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function __toString() { return $this->getOrden() . ': ' . $this->getAmt(); } public function getAmt(): ?float { return $this->amt; } public function setAmt(float $amt): self { $this->amt = $amt; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getPaymentMethod(): ?PaymentMethod { return $this->paymentMethod; } public function setPaymentMethod(?PaymentMethod $paymentMethod): self { $this->paymentMethod = $paymentMethod; return $this; } public function getNota(): ?string { return $this->nota; } public function setNota(?string $nota): self { $this->nota = $nota; return $this; } public function getOrden(): ?Orden { return $this->orden; } public function setOrden(?Orden $orden): self { $this->orden = $orden; return $this; } /** * @return Collection<int, TaxRecord> */ public function getTaxRecords(): Collection { return $this->taxRecords; } public function addTaxRecord(TaxRecord $taxRecord): self { if (!$this->taxRecords->contains($taxRecord)) { $this->taxRecords[] = $taxRecord; $taxRecord->setTransaction($this); } return $this; } public function removeTaxRecord(TaxRecord $taxRecord): self { if ($this->taxRecords->removeElement($taxRecord)) { // set the owning side to null (unless already changed) if ($taxRecord->getTransaction() === $this) { $taxRecord->setTransaction(null); } } return $this; }}