<?php
namespace App\Entity;
use App\Constants\PageTypeConstant;
use App\Traits\MetaImageTrait as MetaImage;
use App\Traits\MetaTrait;
use App\Traits\TimeTrackTrait as TimeTrack;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[UniqueEntity('type')]
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: \App\Repository\MetaRepository::class)]
#[ORM\Table(name: 'meta')]
class Meta
{
use MetaImage;
use TimeTrack;
use MetaTrait;
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var string
*/
#[ORM\Column(name: 'type', type: 'string', length: 191, unique: true)]
private $type;
#[ORM\Column(name: 'position', type: 'integer', nullable: true, options: ['unsigned' => true])]
#[Gedmo\SortablePosition]
private ?int $position = 1;
/**
* @var string
*/
#[ORM\Column(name: 'title', type: 'string', length: 191)]
private $title;
/**
* @var string
*/
#[ORM\Column(name: 'sirTrevorContent', type: 'text', nullable: true)]
protected $sirTrevorContent;
#[ORM\Column(name: 'content', type: 'text', nullable: true)]
protected ?string $content = null;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set type.
*
* @param string $type
*
* @return Meta
*/
public function setType($type): static
{
$this->type = $type;
return $this;
}
/**
* Get type.
*
* @return string
*/
public function getType()
{
return $this->type;
}
public function getTypeLabel(): string
{
$types = PageTypeConstant::loadPageTypes();
return $types[$this->type] ?? $this->type;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): static
{
$this->position = $position;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getSirTrevorContent(): ?string
{
return $this->sirTrevorContent;
}
public function setSirTrevorContent(?string $sirTrevorContent): static
{
$this->sirTrevorContent = $sirTrevorContent;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): static
{
$this->content = $content;
return $this;
}
public function getMetaTitle()
{
return $this->metaTitle;
}
public function getMetaDescription()
{
return $this->metaDescription;
}
public function getMetaKeywords()
{
return $this->metaKeywords;
}
public function getMetaCanonical()
{
return $this->metaCanonical;
}
/**
* Set createdAt.
*
* @param \DateTime|null $createdAt
*
* @return Meta
*/
public function setCreatedAt($createdAt = null)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt.
*
* @return \DateTime|null
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt.
*
* @param \DateTime|null $updatedAt
*
* @return Meta
*/
public function setUpdatedAt($updatedAt = null)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt.
*
* @return \DateTime|null
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function getMetaImage(): ?SonataMediaMedia
{
return $this->meta_image;
}
public function setMetaImage(?SonataMediaMedia $meta_image): static
{
$this->meta_image = $meta_image;
return $this;
}
public function setMetaTitle($metaTitle)
{
$this->metaTitle = $metaTitle;
return $this;
}
public function setMetaDescription($metaDescription)
{
$this->metaDescription = $metaDescription;
return $this;
}
public function setMetaKeywords($metaKeywords)
{
$this->metaKeywords = $metaKeywords;
return $this;
}
public function setMetaCanonical($metaCanonical)
{
$this->metaCanonical = $metaCanonical;
return $this;
}
}