2021-05-30 18:08:31 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
use App\Repository\SectionRepository;
|
2021-05-30 18:18:30 +02:00
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
2021-05-30 18:08:31 +02:00
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Entity(repositoryClass=SectionRepository::class)
|
|
|
|
*/
|
|
|
|
class Section
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @ORM\Id
|
|
|
|
* @ORM\GeneratedValue
|
|
|
|
* @ORM\Column(type="integer")
|
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=255)
|
|
|
|
*/
|
|
|
|
private $title;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=255, nullable=true)
|
|
|
|
*/
|
|
|
|
private $description;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ORM\Column(type="string", length=255, nullable=true)
|
|
|
|
*/
|
|
|
|
private $teaserImage;
|
|
|
|
|
2021-05-30 18:18:30 +02:00
|
|
|
/**
|
|
|
|
* @ORM\ManyToMany(targetEntity=Blog::class, mappedBy="section")
|
|
|
|
*/
|
|
|
|
private $blogs;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->blogs = new ArrayCollection();
|
|
|
|
}
|
|
|
|
|
2021-05-30 18:08:31 +02:00
|
|
|
public function getId(): ?int
|
|
|
|
{
|
|
|
|
return $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle(): ?string
|
|
|
|
{
|
|
|
|
return $this->title;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTitle(string $title): self
|
|
|
|
{
|
|
|
|
$this->title = $title;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription(): ?string
|
|
|
|
{
|
|
|
|
return $this->description;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDescription(?string $description): self
|
|
|
|
{
|
|
|
|
$this->description = $description;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTeaserImage(): ?string
|
|
|
|
{
|
|
|
|
return $this->teaserImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTeaserImage(?string $teaserImage): self
|
|
|
|
{
|
|
|
|
$this->teaserImage = $teaserImage;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2021-05-30 18:18:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Collection|Blog[]
|
|
|
|
*/
|
|
|
|
public function getBlogs(): Collection
|
|
|
|
{
|
|
|
|
return $this->blogs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addBlog(Blog $blog): self
|
|
|
|
{
|
|
|
|
if (!$this->blogs->contains($blog)) {
|
|
|
|
$this->blogs[] = $blog;
|
|
|
|
$blog->addSection($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function removeBlog(Blog $blog): self
|
|
|
|
{
|
|
|
|
if ($this->blogs->removeElement($blog)) {
|
|
|
|
$blog->removeSection($this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
2021-05-30 18:08:31 +02:00
|
|
|
}
|