<?php
namespace App\Entity;
use App\Repository\CommandeIpsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CommandeIpsRepository::class)]
class CommandeIps
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\OneToMany(mappedBy: 'commandeIp', targetEntity: CommandeIpAcheteur::class, orphanRemoval: true)]
private Collection $commandeIpAcheteurs;
public function __construct()
{
$this->commandeIpAcheteurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection<int, CommandeIpAcheteur>
*/
public function getCommandeIpAcheteurs(): Collection
{
return $this->commandeIpAcheteurs;
}
public function addCommandeIpAcheteur(CommandeIpAcheteur $commandeIpAcheteur): static
{
if (!$this->commandeIpAcheteurs->contains($commandeIpAcheteur)) {
$this->commandeIpAcheteurs->add($commandeIpAcheteur);
$commandeIpAcheteur->setCommandeIp($this);
}
return $this;
}
public function removeCommandeIpAcheteur(CommandeIpAcheteur $commandeIpAcheteur): static
{
if ($this->commandeIpAcheteurs->removeElement($commandeIpAcheteur)) {
// set the owning side to null (unless already changed)
if ($commandeIpAcheteur->getCommandeIp() === $this) {
$commandeIpAcheteur->setCommandeIp(null);
}
}
return $this;
}
}