<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\OneToMany;
#[Entity]
#[Table(name: "recette")]
class Recette
{
#[Id]
#[GeneratedValue]
#[Column(type: "integer")]
private int $id;
#[Column(type: "datetime")]
private \DateTimeInterface $date;
#[ManyToMany(targetEntity: Prestation::class)]
#[ORM\JoinTable(name: "recette_prestation",
joinColumns: [new ORM\JoinColumn(name: "recette_id", referencedColumnName: "id")],
inverseJoinColumns: [new ORM\JoinColumn(name: "prestation_id", referencedColumnName: "id")]
)]
private Collection $prestations;
#[OneToMany(targetEntity: PaiementRecette::class, mappedBy: "recette", cascade: ["persist", "remove"])]
private Collection $paiements;
#[Column(type: "string", length: 255, nullable: true)]
private ?string $nomClient = null;
#[Column(type: "decimal", scale: 2, nullable: true)]
private ?float $acompte = null;
#[Column(type: "decimal", scale: 2, nullable: true)]
private ?float $total = null;
public function __construct()
{
$this->prestations = new ArrayCollection();
$this->paiements = new ArrayCollection();
}
public function getId(): int
{
return $this->id;
}
public function getDate(): \DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): void
{
$this->date = $date;
}
public function getPrestations(): Collection
{
return $this->prestations;
}
public function addPrestation(Prestation $prestation): self
{
if (!$this->prestations->contains($prestation)) {
$this->prestations->add($prestation);
}
return $this;
}
public function removePrestation(Prestation $prestation): self
{
$this->prestations->removeElement($prestation);
return $this;
}
public function getPaiements(): Collection
{
return $this->paiements;
}
public function addPaiement(PaiementRecette $paiement): self
{
if (!$this->paiements->contains($paiement)) {
$this->paiements->add($paiement);
$paiement->setRecette($this);
}
return $this;
}
public function removePaiement(PaiementRecette $paiement): self
{
if ($this->paiements->removeElement($paiement)) {
// set the owning side to null (unless already changed)
if ($paiement->getRecette() === $this) {
$paiement->setRecette(null);
}
}
return $this;
}
public function getNomClient(): ?string
{
return $this->nomClient;
}
public function setNomClient(?string $nomClient): void
{
$this->nomClient = $nomClient;
}
public function getAcompte(): ?float
{
return $this->acompte;
}
public function setAcompte(?float $acompte): void
{
$this->acompte = $acompte;
}
public function getTotal(): ?float
{
return $this->total;
}
public function setTotal(?float $total): void
{
$this->total = $total;
}
}