Add ItemExtra entity

This commit is contained in:
lubiana 2024-02-13 21:46:23 +01:00
parent ac248697ff
commit 53009471e1
4 changed files with 138 additions and 3 deletions

60
src/Entity/ItemExtra.php Normal file
View file

@ -0,0 +1,60 @@
<?php
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
{
#[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 $name = null;
#[ORM\ManyToOne(inversedBy: 'itemExtras')]
#[ORM\JoinColumn(nullable: false)]
private ?MenuItem $menuItem = null;
public function __construct() {
$this->id = new Ulid;
}
public function getId(): Ulid
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getMenuItem(): ?MenuItem
{
return $this->menuItem;
}
public function setMenuItem(?MenuItem $menuItem): static
{
$this->menuItem = $menuItem;
return $this;
}
}