<?php
namespace App\Entity;
use App\Repository\PagesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PagesRepository::class)]
class Pages
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'datetime')]
private $modified;
#[ORM\Column(type: 'datetime')]
private $created;
#[ORM\OneToMany(targetEntity: Banners::class, mappedBy: 'page')]
private $banners;
#[ORM\OneToMany(targetEntity: Articles::class, mappedBy: 'page')]
private $articles;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
public function __construct()
{
$this->banners = new ArrayCollection();
$this->articles = new ArrayCollection();
}
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;
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function setModified(\DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
/**
* @return Collection<int, Banners>
*/
public function getBanners(): Collection
{
return $this->banners;
}
public function addBanner(Banners $banner): self
{
if (!$this->banners->contains($banner)) {
$this->banners[] = $banner;
$banner->setPage($this);
}
return $this;
}
public function removeBanner(Banners $banner): self
{
if ($this->banners->removeElement($banner)) {
// set the owning side to null (unless already changed)
if ($banner->getPage() === $this) {
$banner->setPage(null);
}
}
return $this;
}
/**
* @return Collection<int, Articles>
*/
public function getArticles(): Collection
{
return $this->articles;
}
public function addArticle(Articles $article): self
{
if (!$this->articles->contains($article)) {
$this->articles[] = $article;
$article->setPage($this);
}
return $this;
}
public function removeArticle(Articles $article): self
{
if ($this->articles->removeElement($article)) {
// set the owning side to null (unless already changed)
if ($article->getPage() === $this) {
$article->setPage(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}