<?phpnamespace App\Entity;use App\Repository\VenteRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: VenteRepository::class)]class Vente{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(type: Types::DATETIME_MUTABLE)] private ?\DateTimeInterface $dateVente = null; #[ORM\ManyToOne(inversedBy: 'ventes')] #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')] private ?User $vendeur = null; #[ORM\OneToMany(mappedBy: 'vente', targetEntity: DetailsVente::class, cascade: ['persist', 'remove'])] private Collection $detailsVentes; #[ORM\Column(length: 255, nullable: true)] private ?string $motif = null; public function __construct() { $this->detailsVentes = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getDateVente(): ?\DateTimeInterface { return $this->dateVente; } public function setDateVente(\DateTimeInterface $dateVente): static { $this->dateVente = $dateVente; return $this; } public function getVendeur(): ?User { return $this->vendeur; } public function setVendeur(?User $vendeur): static { $this->vendeur = $vendeur; return $this; } /** * @return Collection<int, DetailsVente> */ public function getDetailsVentes(): Collection { return $this->detailsVentes; } public function addDetailsVente(DetailsVente $detailsVente): static { if (!$this->detailsVentes->contains($detailsVente)) { $this->detailsVentes->add($detailsVente); $detailsVente->setVente($this); } return $this; } public function removeDetailsVente(DetailsVente $detailsVente): static { if ($this->detailsVentes->removeElement($detailsVente)) { // set the owning side to null (unless already changed) if ($detailsVente->getVente() === $this) { $detailsVente->setVente(null); } } return $this; } public function getMotif(): ?string { return $this->motif; } public function setMotif(?string $motif): static { $this->motif = $motif; return $this; }}