src/Entity/PublicationImage.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PublicationImageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PublicationImageRepository::class)
  9.  */
  10. class PublicationImage
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $path;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Publication::class, mappedBy="publicationImage")
  28.      */
  29.     private $publications;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Blog::class, mappedBy="blogimage")
  32.      */
  33.     private $blog;
  34.     /**
  35.      * @return mixed
  36.      */
  37.     public function getBlog()
  38.     {
  39.         return $this->blog;
  40.     }
  41.     /**
  42.      * @param mixed $blog
  43.      */
  44.     public function setBlog($blog): void
  45.     {
  46.         $this->blog $blog;
  47.     }
  48.     public function __construct()
  49.     {
  50.         $this->publications = new ArrayCollection();
  51.     }
  52.     public function getId(): ?int
  53.     {
  54.         return $this->id;
  55.     }
  56.     public function getName(): ?string
  57.     {
  58.         return $this->name;
  59.     }
  60.     public function setName(string $name): self
  61.     {
  62.         $this->name $name;
  63.         return $this;
  64.     }
  65.     public function getPath(): ?string
  66.     {
  67.         return $this->path;
  68.     }
  69.     public function setPath(string $path): self
  70.     {
  71.         $this->path $path;
  72.         return $this;
  73.     }
  74.     /**
  75.      * @return Collection|Publication[]
  76.      */
  77.     public function getPublications(): Collection
  78.     {
  79.         return $this->publications;
  80.     }
  81.     public function addPublication(Publication $publication): self
  82.     {
  83.         if (!$this->publications->contains($publication)) {
  84.             $this->publications[] = $publication;
  85.             $publication->setPublicationImage($this);
  86.         }
  87.         return $this;
  88.     }
  89.     public function removePublication(Publication $publication): self
  90.     {
  91.         if ($this->publications->removeElement($publication)) {
  92.             // set the owning side to null (unless already changed)
  93.             if ($publication->getPublicationImage() === $this) {
  94.                 $publication->setPublicationImage(null);
  95.             }
  96.         }
  97.         return $this;
  98.     }
  99.    
  100. }