<?php
declare(strict_types=1);
namespace App\Entity;
use App\Annotation\DatabaseSubscriberClient;
use App\Entity\Traits\EntitySEOTrait;
use App\Entity\Traits\EntitySoftDeletableTrait;
use App\Entity\Traits\EntityTimestampableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\Mapping\Annotation\SoftDeleteable;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
use JMS\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass="App\Repository\InspirationRepository")
* @SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=false)
* @ExclusionPolicy("all")
* @DatabaseSubscriberClient()
*/
class Inspiration extends BaseDomain
{
use EntityTimestampableTrait;
use EntitySoftDeletableTrait;
use EntitySEOTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @var string $slug
*
* @Gedmo\Slug(fields={"title"})
* @ORM\Column(length=255, unique=true)
*/
private $slug;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $shortDesc;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $content;
/**
* @ORM\ManyToOne(targetEntity="SonataMediaMedia")
*/
private $media;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $position;
/**
* @ORM\Column(type="boolean", options={"default": true})
*/
private bool $isVisible = true;
/**
* @ORM\OneToMany(targetEntity="InspirationGallery", mappedBy="inspiration", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $galleries;
public function __toString()
{
if ($this->title) {
return $this->title;
}
return '';
}
public function __construct()
{
$this->galleries = new ArrayCollection();
$this->position = 1;
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @param mixed $title
*/
public function setTitle($title): void
{
$this->title = $title;
}
/**
*/
public function getSlug(): string
{
return $this->slug;
}
/**
*/
public function setSlug(string $slug): void
{
$this->slug = $slug;
}
/**
* @return mixed
*/
public function getShortDesc()
{
return $this->shortDesc;
}
/**
* @param mixed $shortDesc
*/
public function setShortDesc($shortDesc): void
{
$this->shortDesc = $shortDesc;
}
/**
* @return mixed
*/
public function getContent()
{
return $this->content;
}
/**
* @param mixed $content
*/
public function setContent($content): void
{
$this->content = $content;
}
/**
* @return mixed
*/
public function getMedia()
{
return $this->media;
}
/**
* @param mixed $media
*/
public function setMedia($media): void
{
$this->media = $media;
}
/**
* @return mixed
*/
public function getPosition()
{
return $this->position;
}
/**
* @param mixed $position
*/
public function setPosition($position)
{
$this->position = $position;
}
/**
* @return Collection|InspirationGallery[]
*/
public function getGalleries()
{
return $this->galleries;
}
public function addGallery(InspirationGallery $gallery)
{
if (!$this->galleries->contains($gallery)) {
$this->galleries[] = $gallery;
$gallery->setInspiration($this);
}
return $this;
}
public function removeGallery(InspirationGallery $gallery)
{
if ($this->galleries->removeElement($gallery)) {
$gallery->setInspiration(null);
}
return $this;
}
public function isVisible(): bool
{
return $this->isVisible;
}
public function setIsVisible(bool $isVisible): self
{
$this->isVisible = $isVisible;
return $this;
}
}