<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: \App\Repository\PlacementImageRepository::class)]
class PlacementImage implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $name= null;
#[ORM\OneToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'position_image')]
private mixed $posts;
#[ORM\OneToMany(targetEntity: PageAccueil::class, mappedBy: 'image_enavant_placement')]
private mixed $pageAccueils;
public function __construct()
{
$this->posts = new ArrayCollection();
$this->pageAccueils = new ArrayCollection();
}
public function __toString(): string
{
return (string) $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection|Post[]
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->setPositionImage($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
// set the owning side to null (unless already changed)
if ($post->getPositionImage() === $this) {
$post->setPositionImage(null);
}
}
return $this;
}
/**
* @return Collection|PageAccueil[]
*/
public function getPageAccueils(): Collection
{
return $this->pageAccueils;
}
public function addPageAccueil(PageAccueil $pageAccueil): self
{
if (!$this->pageAccueils->contains($pageAccueil)) {
$this->pageAccueils[] = $pageAccueil;
$pageAccueil->setImageEnavantPlacement($this);
}
return $this;
}
public function removePageAccueil(PageAccueil $pageAccueil): self
{
if ($this->pageAccueils->removeElement($pageAccueil)) {
// set the owning side to null (unless already changed)
if ($pageAccueil->getImageEnavantPlacement() === $this) {
$pageAccueil->setImageEnavantPlacement(null);
}
}
return $this;
}
}