<?php
namespace App\Entity;
use App\Entity\Eventable\EventableTrait;
use App\Entity\Sortable\Sortable;
use App\Entity\Sortable\SortableInterface;
use App\Repository\ContentRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ContentRepository::class)
*/
class Content implements SortableInterface
{
use Sortable;
use EventableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=128, unique=true)
*/
private $code;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $body;
/**
* @ORM\ManyToMany(targetEntity=Image::class, cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $images;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $style;
public function __construct()
{
$this->images = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
public function getBody(): ?string
{
return $this->body;
}
public function setBody(?string $body): self
{
$this->body = $body;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
/**
* @return Collection<int, Image>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Image $image): self
{
if (!$this->images->contains($image)) {
$this->images[] = $image;
}
return $this;
}
public function removeImage(Image $image): self
{
$this->images->removeElement($image);
return $this;
}
public function getStyle(): ?string
{
return $this->style;
}
public function setStyle(?string $style): self
{
$this->style = $style;
return $this;
}
}