<?php
namespace App\Entity;
use App\Repository\FraisdelivRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FraisdelivRepository::class)]
class Fraisdeliv
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $region = null;
#[ORM\Column(length: 255)]
private ?string $prix = null;
#[ORM\OneToMany(mappedBy: 'region', targetEntity: Client::class, orphanRemoval: true, cascade: ["remove"])]
private Collection $clients;
public function __construct()
{
$this->clients = new ArrayCollection();
}
public function __toString(): string
{
// Retournez ici la représentation sous forme de chaîne de votre entité
// Par exemple, vous pouvez retourner une propriété spécifique de votre entité
// Exemple : retourner le nom de l'entité
return $this->region;
}
public function getId(): ?int
{
return $this->id;
}
public function getRegion(): ?string
{
return $this->region;
}
public function setRegion(string $region): self
{
$this->region = $region;
return $this;
}
public function getPrix(): ?string
{
return $this->prix;
}
public function setPrix(string $prix): self
{
$this->prix = $prix;
return $this;
}
/**
* @return Collection<int, Client>
*/
public function getClients(): Collection
{
return $this->clients;
}
public function addClient(Client $client): self
{
if (!$this->clients->contains($client)) {
$this->clients->add($client);
$client->setRegion($this);
}
return $this;
}
public function removeClient(Client $client): self
{
if ($this->clients->removeElement($client)) {
// set the owning side to null (unless already changed)
if ($client->getRegion() === $this) {
$client->setRegion(null);
}
}
return $this;
}
}