<?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\SortOrderTrait;
use App\Entity\Traits\TranslateTrait;
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;
/**
* MeetTheTeam.
*
* @Gedmo\Loggable
*
* @Gedmo\TranslationEntity(class="App\Entity\TeamMemberTranslations")
*/
#[ORM\Entity(repositoryClass: \App\Repository\MeetTheTeamRepository::class)]
#[ORM\Table(name: 'meettheteam')]
class TeamMember implements DefaultLinkedEntity
{
use TitleAndContentTrait;
use LinkTrait;
use MetaTrait;
use ActiveTrait;
use DeleteTrait;
use ImageUploadTrait;
use TimestampableEntity;
use TranslateTrait;
use SortOrderTrait;
use SitemapableTrait;
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private readonly int $id;
/**
* @Gedmo\Translatable
*/
#[Assert\NotBlank(message: 'The position should not be blank')]
#[ORM\Column(name: 'position', type: 'string', length: 255)]
private ?string $position = null;
#[Assert\Url(message: 'The LinkedIn URL is not valid')]
#[ORM\Column(name: 'linkedin_url', type: 'string', length: 255, nullable: true)]
private ?string $linkedinUrl = null;
#[Assert\Email(message: 'The email address is not valid')]
#[ORM\Column(name: 'email', type: 'string', length: 255, nullable: true)]
private ?string $email = null;
#[ORM\Column(name: 'post_nominal', type: 'string', length: 255, nullable: true)]
private ?string $postNominal = null;
#[ORM\Column(name: 'featured', type: 'boolean', nullable: true)]
private ?bool $featured = false;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $cta_text;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $cta_link;
#[ORM\ManyToOne(targetEntity: Testimonial::class)]
#[ORM\JoinColumn(nullable: true)]
private $testimonial;
/**
* 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;
/**
* Get id.
*/
public function getId(): int
{
return $this->id;
}
/**
* Set position.
*
* @param string $position
*/
public function setPosition($position): self
{
$this->position = $position;
return $this;
}
/**
* Get position.
*/
public function getPosition(): ?string
{
return $this->position;
}
// REQUIRED BY THE LINKS TRAIT
public function getLinkedPageId(): int
{
return 5;
}
public function getLinkedinUrl(): ?string
{
return $this->linkedinUrl;
}
public function setLinkedinUrl(?string $linkedinUrl): self
{
$this->linkedinUrl = $linkedinUrl;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPostNominal(): ?string
{
return $this->postNominal;
}
public function setPostNominal(?string $postNominal): self
{
$this->postNominal = $postNominal;
return $this;
}
public function getFeatured(): ?bool
{
return $this->featured;
}
public function setFeatured(?bool $featured): self
{
$this->featured = $featured;
return $this;
}
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 getTestimonial(): ?Testimonial
{
return $this->testimonial;
}
public function setTestimonial(?Testimonial $testimonial): self
{
$this->testimonial = $testimonial;
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;
}
}