<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\SliderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SliderRepository::class)]
#[ApiResource]
class Slider
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $slug = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $content = null;
#[ORM\OneToMany(mappedBy: 'slider', targetEntity: PageInfos::class)]
private Collection $pageInfos;
public function __construct()
{
$this->pageInfos = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): static
{
$this->content = $content;
return $this;
}
/**
* @return Collection<int, PageInfos>
*/
public function getPageInfos(): Collection
{
return $this->pageInfos;
}
public function addPageInfo(PageInfos $pageInfo): static
{
if (!$this->pageInfos->contains($pageInfo)) {
$this->pageInfos->add($pageInfo);
$pageInfo->setSlider($this);
}
return $this;
}
public function removePageInfo(PageInfos $pageInfo): static
{
if ($this->pageInfos->removeElement($pageInfo)) {
// set the owning side to null (unless already changed)
if ($pageInfo->getSlider() === $this) {
$pageInfo->setSlider(null);
}
}
return $this;
}
}