src\Entity\TypePub.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\TypePubRepository::class)]
  7. class TypePub
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $libelle;
  15.     #[ORM\OneToMany(targetEntity\App\Entity\Publicite::class, mappedBy'type')]
  16.     private $publicite;
  17.     public function __construct()
  18.     {
  19.         $this->publicite = new ArrayCollection();
  20.     }
  21.     public function getId(): ?int
  22.     {
  23.         return $this->id;
  24.     }
  25.     public function getLibelle(): ?string
  26.     {
  27.         return $this->libelle;
  28.     }
  29.     public function setLibelle(string $libelle): self
  30.     {
  31.         $this->libelle $libelle;
  32.         return $this;
  33.     }
  34.     /**
  35.      * @return Collection|Publicite[]
  36.      */
  37.     public function getPublicite(): Collection
  38.     {
  39.         return $this->publicite;
  40.     }
  41.     public function addPublicite(Publicite $publicite): self
  42.     {
  43.         if (!$this->publicite->contains($publicite)) {
  44.             $this->publicite[] = $publicite;
  45.             $publicite->setType($this);
  46.         }
  47.         return $this;
  48.     }
  49.     public function removePublicite(Publicite $publicite): self
  50.     {
  51.         if ($this->publicite->contains($publicite)) {
  52.             $this->publicite->removeElement($publicite);
  53.             // set the owning side to null (unless already changed)
  54.             if ($publicite->getType() === $this) {
  55.                 $publicite->setType(null);
  56.             }
  57.         }
  58.         return $this;
  59.     }
  60. }