<?php
namespace App\Entity;
use App\Repository\DonneePerformanceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: DonneePerformanceRepository::class)]
class DonneePerformance
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
#[Assert\NotNull(message: 'La date de publication des données doit être renseignée')]
private ?\DateTimeInterface $datePublicationDonneesExecution = null;
#[ORM\Column(type: Types::DECIMAL, precision: 20, scale: 2)]
#[Assert\Type(type: 'numeric', message: 'Le montant de la dépense doit être un nombre.')]
#[Assert\NotNull(message: 'Les dépenses doivent être renseignées')]
private ?string $depenseInvestissement = null;
#[ORM\OneToMany(mappedBy: 'donneePerformance', targetEntity: TarifUsager::class, cascade: ['persist'])]
private Collection $tarifUsager;
#[ORM\ManyToOne(targetEntity:Concession::class ,inversedBy: 'donneePerformance')]
#[ORM\JoinColumn(name:'concession_id', referencedColumnName: 'id', nullable: true)]
private ?Concession $concession = null;
public function __construct()
{
$this->tarifUsager = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDatePublicationDonneesExecution(): ?\DateTimeInterface
{
return $this->datePublicationDonneesExecution;
}
public function setDatePublicationDonneesExecution(\DateTimeInterface $datePublicationDonneesExecution): static
{
$this->datePublicationDonneesExecution = $datePublicationDonneesExecution;
return $this;
}
public function getDepenseInvestissement(): ?string
{
return $this->depenseInvestissement;
}
public function setDepenseInvestissement(string $depenseInvestissement): static
{
$this->depenseInvestissement = $depenseInvestissement;
return $this;
}
/**
* @return Collection<int, TarifUsager>
*/
public function getTarifUsager(): Collection
{
return $this->tarifUsager;
}
public function addTarifUsager(TarifUsager $tarifUsager): static
{
if (!$this->tarifUsager->contains($tarifUsager)) {
$this->tarifUsager->add($tarifUsager);
$tarifUsager->setDonneePerformance($this);
}
return $this;
}
public function removeTarifUsager(TarifUsager $tarifUsager): static
{
if ($this->tarifUsager->removeElement($tarifUsager)) {
// set the owning side to null (unless already changed)
if ($tarifUsager->getDonneePerformance() === $this) {
$tarifUsager->setDonneePerformance(null);
}
}
return $this;
}
public function getConcession(): ?Concession
{
return $this->concession;
}
public function setConcession(?Concession $concession): static
{
$this->concession = $concession;
return $this;
}
}