This commit is contained in:
lubiana 2024-02-12 22:03:17 +01:00
parent 203233d2ed
commit 93fa2da696
45 changed files with 2633 additions and 550 deletions

View file

@ -1,4 +1,5 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
namespace App\Entity;
@ -11,23 +12,48 @@ use Symfony\Component\Uid\Ulid;
#[ORM\Entity(repositoryClass: MenuItemAliasRepository::class)]
class MenuItemAlias
{
public function __construct(
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: UlidType::NAME, unique: true)]
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
public Ulid $id = new Ulid,
#[ORM\ManyToOne(inversedBy: 'aliases')]
#[ORM\JoinColumn(nullable: false)]
public MenuItem|null $menuItem = null,
#[ORM\Column(length: 255)]
public string|null $name = null,
) {}
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: UlidType::NAME, unique: true)]
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
private Ulid $id;
public static function new(string $name): self
#[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()
{
$new = new self;
$new->name = $name;
return $new;
$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;
}
}