<?phpnamespace App\Entity;use App\Entity\Base\AbstractTimestampableEntity;use App\Repository\CurrencyRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CurrencyRepository::class) * @ORM\HasLifecycleCallbacks */class Currency extends AbstractTimestampableEntity{ const CURRENCY_RON = 1; const CURRENCY_EUR = 2; const CURRENCY_HUF = 3; const CURRENCY_USD = 4; /** * @ORM\Column(type="string", length=255) */ private string $name; /** * @ORM\Column(type="decimal", precision=10, scale=6) */ private float $value; /** * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="currency") */ private $offers; /** * @ORM\OneToMany(targetEntity=Task::class, mappedBy="currency") */ private $tasks; /** * @ORM\OneToMany(targetEntity=FacturiHeader::class, mappedBy="currency") */ private $facturiHeaders; public function __construct() { $this->offers = new ArrayCollection(); $this->tasks = new ArrayCollection(); $this->facturiHeaders = new ArrayCollection(); } public function getName(): string { return $this->name; } public function setName(string $name): void { $this->name = $name; } public function getValue(): float { return $this->value; } public function setValue(float $value): void { $this->value = $value; } /** * @return Collection<int, Offer> */ public function getOffers(): Collection { return $this->offers; } public function addOffer(Offer $offer): self { if (!$this->offers->contains($offer)) { $this->offers[] = $offer; $offer->setCurrency($this); } return $this; } public function removeOffer(Offer $offer): self { if ($this->offers->removeElement($offer)) { // set the owning side to null (unless already changed) if ($offer->getCurrency() === $this) { $offer->setCurrency(null); } } return $this; } /** * @return Collection<int, Task> */ public function getTasks(): Collection { return $this->tasks; } public function addTask(Task $task): self { if (!$this->tasks->contains($task)) { $this->tasks[] = $task; $task->setCurrency($this); } return $this; } public function removeTask(Task $task): self { if ($this->tasks->removeElement($task)) { // set the owning side to null (unless already changed) if ($task->getCurrency() === $this) { $task->setCurrency(null); } } return $this; } /** * @return Collection<int, FacturiHeader> */ public function getFacturiHeaders(): Collection { return $this->facturiHeaders; } public function addFacturiHeader(FacturiHeader $facturiHeader): self { if (!$this->facturiHeaders->contains($facturiHeader)) { $this->facturiHeaders[] = $facturiHeader; $facturiHeader->setCurrency($this); } return $this; } public function removeFacturiHeader(FacturiHeader $facturiHeader): self { if ($this->facturiHeaders->removeElement($facturiHeader)) { // set the owning side to null (unless already changed) if ($facturiHeader->getCurrency() === $this) { $facturiHeader->setCurrency(null); } } return $this; }}