Add ItemExtra entity
This commit is contained in:
parent
ac248697ff
commit
53009471e1
4 changed files with 138 additions and 3 deletions
60
src/Entity/ItemExtra.php
Normal file
60
src/Entity/ItemExtra.php
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue