<?phpnamespace App\Entity;use App\Repository\CurrencyRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\UX\Turbo\Attribute\Broadcast;#[ORM\Entity(repositoryClass: CurrencyRepository::class)]#[Broadcast]class Currency{ use IdentifiableTrait; #[ORM\Column(length: 15)] private ?string $name = null; #[ORM\Column(length: 10)] private ?string $symbol = null; #[ORM\OneToMany(mappedBy: 'currency', targetEntity: CurrencyRate::class)] private Collection $currencyRates; #[ORM\OneToMany(mappedBy: 'currency', targetEntity: Invoice::class)] private Collection $invoices; #[ORM\OneToMany(mappedBy: 'currency', targetEntity: PrescriberPoint::class)] private Collection $prescriberPoints; #[ORM\Column(length: 5, nullable: true)] private ?string $isoCode = null; public function __construct() { $this->currencyRates = new ArrayCollection(); $this->invoices = new ArrayCollection(); $this->prescriberPoints = new ArrayCollection(); } public function __toString(): string { return $this->getName()." (".$this->getSymbol().")"; } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getSymbol(): ?string { return $this->symbol; } public function setSymbol(string $symbol): self { $this->symbol = $symbol; return $this; } /** * @return Collection<int, CurrencyRate> */ public function getCurrencyRates(): Collection { return $this->currencyRates; } public function addCurrencyRate(CurrencyRate $currencyRate): self { if (!$this->currencyRates->contains($currencyRate)) { $this->currencyRates->add($currencyRate); $currencyRate->setCurrency($this); } return $this; } public function removeCurrencyRate(CurrencyRate $currencyRate): self { if ($this->currencyRates->removeElement($currencyRate)) { // set the owning side to null (unless already changed) if ($currencyRate->getCurrency() === $this) { $currencyRate->setCurrency(null); } } return $this; } /** * @return Collection<int, Invoice> */ public function getInvoices(): Collection { return $this->invoices; } public function addInvoice(Invoice $invoice): self { if (!$this->invoices->contains($invoice)) { $this->invoices->add($invoice); $invoice->setCurrency($this); } return $this; } public function removeInvoice(Invoice $invoice): self { if ($this->invoices->removeElement($invoice)) { // set the owning side to null (unless already changed) if ($invoice->getCurrency() === $this) { $invoice->setCurrency(null); } } return $this; } /** * @return Collection<int, PrescriberPoint> */ public function getPrescriberPoints(): Collection { return $this->prescriberPoints; } public function addPrescriberPoint(PrescriberPoint $prescriberPoint): self { if (!$this->prescriberPoints->contains($prescriberPoint)) { $this->prescriberPoints->add($prescriberPoint); $prescriberPoint->setCurrency($this); } return $this; } public function removePrescriberPoint(PrescriberPoint $prescriberPoint): self { if ($this->prescriberPoints->removeElement($prescriberPoint)) { // set the owning side to null (unless already changed) if ($prescriberPoint->getCurrency() === $this) { $prescriberPoint->setCurrency(null); } } return $this; } public function getIsoCode(): ?string { return $this->isoCode; } public function setIsoCode(?string $isoCode): static { $this->isoCode = $isoCode; return $this; }}