<?php declare(strict_types=1);
namespace App\Entity;
use App\Repository\AnalysisServicePriceRepository;
use DateTimeImmutable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Timestampable\Traits\TimestampableEntity;
#[ORM\Table]
#[ORM\Entity(repositoryClass: AnalysisServicePriceRepository::class)]
class AnalysisServicePrice
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\ManyToOne(targetEntity: AnalysisService::class, inversedBy: 'prices')]
private AnalysisService $service;
#[ORM\ManyToOne(targetEntity: Company::class, inversedBy: 'prices')]
private ?Company $company;
#[ORM\Column(type: 'float', nullable: true)]
private ?float $price = null;
#[ORM\OneToMany(mappedBy: 'price', targetEntity: AnalysisServicePriceModifier::class, cascade: ['all'], orphanRemoval: true)]
private iterable $modifier;
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
private ?DateTimeImmutable $validFrom = null;
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
private ?DateTimeImmutable $validTo = null;
public function __construct()
{
$this->modifier = new ArrayCollection();
$this->company = null;
}
public function getId(): int
{
return $this->id;
}
public function setId(int $id): AnalysisServicePrice
{
$this->id = $id;
return $this;
}
public function getService(): AnalysisService
{
return $this->service;
}
public function setService(AnalysisService $service): AnalysisServicePrice
{
$this->service = $service;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): AnalysisServicePrice
{
$this->company = $company;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): AnalysisServicePrice
{
$this->price = $price;
return $this;
}
public function getModifier(): iterable
{
return $this->modifier;
}
public function getValidFrom(): ?DateTimeImmutable
{
return $this->validFrom;
}
public function setValidFrom(?DateTimeImmutable $validFrom): AnalysisServicePrice
{
$this->validFrom = $validFrom;
return $this;
}
public function getValidTo(): ?DateTimeImmutable
{
return $this->validTo;
}
public function setValidTo(?DateTimeImmutable $validTo): AnalysisServicePrice
{
$this->validTo = $validTo;
return $this;
}
}