<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation\Slug;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\MappedSuperclass()]
#[UniqueEntity('slug')]
class BaseNameSlug
{
#[ORM\Column(length: 127)]
#[Assert\NotNull()]
#[Assert\Length(max: 127)]
private ?string $name = null;
#[ORM\Column(length: 255, unique: true)]
#[Slug(fields: ['name'])]
private ?string $slug = null;
public function __toString()
{
return $this->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
}