futtern/src/Entity/ItemExtra.php
2024-03-17 21:05:03 +01:00

53 lines
1.3 KiB
PHP

<?php declare(strict_types=1);
namespace App\Entity;
use App\Repository\ItemExtraRepository;
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: ItemExtraRepository::class)]
class ItemExtra
{
public function __construct(
#[ORM\Column(length: 50)]
private string|null $name = null,
#[ORM\ManyToOne(inversedBy: 'itemExtras')]
#[ORM\JoinColumn(nullable: false)]
private MenuItem|null $menuItem = null,
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\Column(type: UlidType::NAME, unique: true)]
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
private Ulid $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;
}
}