59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\MenuItemAliasRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
|
|
use Symfony\Bridge\Doctrine\Types\UlidType;
|
|
use Symfony\Component\Uid\Ulid;
|
|
|
|
#[ORM\Entity(repositoryClass: MenuItemAliasRepository::class)]
|
|
class MenuItemAlias
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
|
#[ORM\Column(type: UlidType::NAME, unique: true)]
|
|
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
|
|
private Ulid $id;
|
|
|
|
#[ORM\Column(length: 50)]
|
|
private string|null $name = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'menuItemAliases')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private MenuItem|null $menuItem = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->id = new Ulid;
|
|
}
|
|
|
|
public function getId(): Ulid
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getName(): string|null
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName(string $name): static
|
|
{
|
|
$this->name = $name;
|
|
return $this;
|
|
}
|
|
|
|
public function getMenuItem(): MenuItem|null
|
|
{
|
|
return $this->menuItem;
|
|
}
|
|
|
|
public function setMenuItem(MenuItem|null $menuItem): static
|
|
{
|
|
$this->menuItem = $menuItem;
|
|
return $this;
|
|
}
|
|
}
|