<?php
namespace App\Entity;
use App\Entity\Traits\LinkTrait;
use App\Entity\Traits\MetaTrait;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\ActiveTrait;
use App\Entity\Traits\DeleteTrait;
use App\Entity\Traits\SubTitleTrait;
use App\Entity\Traits\TranslateTrait;
use App\Entity\Traits\FileUploadTrait;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Entity\Traits\ImageUploadTrait;
use App\Entity\Traits\SitemapableTrait;
use App\Entity\Traits\TitleAndContentTrait;
use App\Entity\Interfaces\DefaultLinkedEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* CaseStudies.
*
* @Gedmo\Loggable
*
* @Gedmo\TranslationEntity(class="App\Entity\CaseStudiesTranslations")
*/
#[ORM\Entity(repositoryClass: \App\Repository\CaseStudiesRepository::class)]
#[ORM\Table(name: 'casestudies')]
class CaseStudies implements DefaultLinkedEntity
{
use TitleAndContentTrait;
use SubTitleTrait;
use LinkTrait;
use MetaTrait;
use ActiveTrait;
use DeleteTrait;
use ImageUploadTrait;
use FileUploadTrait;
use TimestampableEntity;
use TranslateTrait;
use SitemapableTrait;
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private readonly int $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $cta_text;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $cta_link;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $quote;
#[ORM\ManyToOne(targetEntity: Testimonial::class)]
private $testimonial;
#[ORM\Column(type: 'boolean', nullable: true)]
private $featured;
#[ORM\Column(name: 'logo', type: 'string', length: 255, nullable: true)]
private ?string $logo = null;
/**
* Override slug from LinkTrait to disable auto-update.
* Slug will only be auto-generated on create, but can be manually set.
*
* @Gedmo\Translatable
*
* @Gedmo\Versioned
*
* @Gedmo\Slug(fields={"title"}, separator="-", updatable=false)
*/
#[ORM\Column(length: 255, unique: true)]
private ?string $slug = null;
public function getId(): int
{
return $this->id;
}
// REQUIRED BY THE META LINKS TRAIT
public function getLinkedPageId(): int
{
return 9;
}
public function getCtaText(): ?string
{
return $this->cta_text;
}
public function setCtaText(?string $cta_text): self
{
$this->cta_text = $cta_text;
return $this;
}
public function getCtaLink(): ?string
{
return $this->cta_link;
}
public function setCtaLink(?string $cta_link): self
{
$this->cta_link = $cta_link;
return $this;
}
public function getQuote(): ?string
{
return $this->quote;
}
public function setQuote(?string $quote): self
{
$this->quote = $quote;
return $this;
}
public function getTestimonial(): ?Testimonial
{
return $this->testimonial;
}
public function setTestimonial(?Testimonial $testimonial): self
{
$this->testimonial = $testimonial;
return $this;
}
public function getFeatured(): ?bool
{
return $this->featured;
}
public function setFeatured(?bool $featured): self
{
$this->featured = $featured;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getSitemapRouteParams(): array
{
return ['slug' => $this->getSlug()];
}
public function isIncludedInSitemap(): bool
{
return $this->isActive() &&
! $this->isDeleted();
;
}
/**
* Override setSlug from LinkTrait to allow manual setting.
* If empty string is provided, set to null to allow auto-generation on create.
*/
public function setSlug(?string $slug): void
{
// Convert empty string to null so Gedmo can auto-generate on create
$this->slug = ($slug === '' || $slug === null) ? null : $slug;
}
}