<?php
namespace App\Billing\Entity;
use App\Repository\InvoiceLineRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: InvoiceLineRepository::class)]
class InvoiceLine
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'lines')]
#[ORM\JoinColumn(nullable: false)]
private ?Invoice $invoice = null;
#[ORM\Column(length: 255)]
private ?string $description = null;
#[ORM\Column]
private ?int $quantity = 1;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
private ?string $unitPrice = null;
#[ORM\Column(type: Types::DECIMAL, precision: 5, scale: 2)]
private ?string $taxRate = '0.00'; // Percentage, e.g. 20.00 for 20%
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
private ?string $totalHt = null;
#[ORM\Column(type: Types::DECIMAL, precision: 10, scale: 2)]
private ?string $totalTtc = null;
// Polymorphic link to related entity (e.g., Inscription ID 123)
// We store Class + ID.
#[ORM\Column(length: 255, nullable: true)]
private ?string $relatedEntityClass = null;
#[ORM\Column(nullable: true)]
private ?int $relatedEntityId = null;
public function getId(): ?int
{
return $this->id;
}
public function getInvoice(): ?Invoice
{
return $this->invoice;
}
public function setInvoice(?Invoice $invoice): static
{
$this->invoice = $invoice;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getQuantity(): ?int
{
return $this->quantity;
}
public function setQuantity(int $quantity): static
{
$this->quantity = $quantity;
return $this;
}
public function getUnitPrice(): ?string
{
return $this->unitPrice;
}
public function setUnitPrice(string $unitPrice): static
{
$this->unitPrice = $unitPrice;
return $this;
}
public function getTaxRate(): ?string
{
return $this->taxRate;
}
public function setTaxRate(string $taxRate): static
{
$this->taxRate = $taxRate;
return $this;
}
public function getTotalHt(): ?string
{
return $this->totalHt;
}
public function setTotalHt(string $totalHt): static
{
$this->totalHt = $totalHt;
return $this;
}
public function getTotalTtc(): ?string
{
return $this->totalTtc;
}
public function setTotalTtc(string $totalTtc): static
{
$this->totalTtc = $totalTtc;
return $this;
}
public function getRelatedEntityClass(): ?string
{
return $this->relatedEntityClass;
}
public function setRelatedEntityClass(?string $relatedEntityClass): static
{
$this->relatedEntityClass = $relatedEntityClass;
return $this;
}
public function getRelatedEntityId(): ?int
{
return $this->relatedEntityId;
}
public function setRelatedEntityId(?int $relatedEntityId): static
{
$this->relatedEntityId = $relatedEntityId;
return $this;
}
}