src/Entity/EpingleColor.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EpingleColorRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassEpingleColorRepository::class)]
  8. class EpingleColor implements \Stringable
  9. {
  10.   #[ORM\Id]
  11.   #[ORM\GeneratedValue]
  12.   #[ORM\Column(type'integer')]
  13.   private int $id;
  14.   #[ORM\Column(type'string'length255)]
  15.   private ?string $namenull;
  16.   #[ORM\OneToMany(targetEntityEpingle::class, mappedBy'color')]
  17.   private mixed $epingles;
  18.   public function __construct()
  19.   {
  20.     $this->epingles = new ArrayCollection();
  21.   }
  22.   public function __toString(): string
  23.   {
  24.     return (string) $this->name;
  25.   }
  26.   public function getId(): ?int
  27.   {
  28.     return $this->id;
  29.   }
  30.   public function getName(): ?string
  31.   {
  32.     return $this->name;
  33.   }
  34.   public function setName(string $name): self
  35.   {
  36.     $this->name $name;
  37.     return $this;
  38.   }
  39.   /**
  40.    * @return Collection|Epingle[]
  41.    */
  42.   public function getEpingles(): Collection
  43.   {
  44.     return $this->epingles;
  45.   }
  46.   public function addEpingle(Epingle $epingle): self
  47.   {
  48.     if (!$this->epingles->contains($epingle)) {
  49.       $this->epingles[] = $epingle;
  50.       $epingle->setColor($this);
  51.     }
  52.     return $this;
  53.   }
  54.   public function removeEpingle(Epingle $epingle): self
  55.   {
  56.     if ($this->epingles->removeElement($epingle)) {
  57.       // set the owning side to null (unless already changed)
  58.       if ($epingle->getColor() === $this) {
  59.         $epingle->setColor(null);
  60.       }
  61.     }
  62.     return $this;
  63.   }
  64. }