src/Entity/CommandeIps.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommandeIpsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassCommandeIpsRepository::class)]
  9. class CommandeIps
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $name null;
  17.     #[ORM\OneToMany(mappedBy'commandeIp'targetEntityCommandeIpAcheteur::class, orphanRemovaltrue)]
  18.     private Collection $commandeIpAcheteurs;
  19.     public function __construct()
  20.     {
  21.         $this->commandeIpAcheteurs = new ArrayCollection();
  22.     }
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getName(): ?string
  28.     {
  29.         return $this->name;
  30.     }
  31.     public function setName(string $name): static
  32.     {
  33.         $this->name $name;
  34.         return $this;
  35.     }
  36.     public function __toString()
  37.     {
  38.         return $this->name;
  39.     }
  40.     /**
  41.      * @return Collection<int, CommandeIpAcheteur>
  42.      */
  43.     public function getCommandeIpAcheteurs(): Collection
  44.     {
  45.         return $this->commandeIpAcheteurs;
  46.     }
  47.     public function addCommandeIpAcheteur(CommandeIpAcheteur $commandeIpAcheteur): static
  48.     {
  49.         if (!$this->commandeIpAcheteurs->contains($commandeIpAcheteur)) {
  50.             $this->commandeIpAcheteurs->add($commandeIpAcheteur);
  51.             $commandeIpAcheteur->setCommandeIp($this);
  52.         }
  53.         return $this;
  54.     }
  55.     public function removeCommandeIpAcheteur(CommandeIpAcheteur $commandeIpAcheteur): static
  56.     {
  57.         if ($this->commandeIpAcheteurs->removeElement($commandeIpAcheteur)) {
  58.             // set the owning side to null (unless already changed)
  59.             if ($commandeIpAcheteur->getCommandeIp() === $this) {
  60.                 $commandeIpAcheteur->setCommandeIp(null);
  61.             }
  62.         }
  63.         return $this;
  64.     }
  65. }