<?php
namespace App\Entity;
use App\Entity\Toppings;
use App\Entity\FoodCategory;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\FoodItemRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Entity(repositoryClass: FoodItemRepository::class)]
class FoodItem
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'integer')]
private ?int $orderId = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $pos_id = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $pos_id_1050 = null;
#[ORM\Column(type: 'string', length: 255)]
private ?string $pos_id_10202 = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(type: 'float')]
private ?float $price = null;
#[ORM\Column(type: 'boolean')]
private bool $is_active = true;
#[ORM\Column(type: 'string', length: 255)]
private ?string $description = null;
#[ORM\ManyToOne(targetEntity: FoodCategory::class, inversedBy: 'foodItems')]
#[ORM\JoinColumn(nullable: false)]
private ?FoodCategory $category = null;
#[ORM\ManyToMany(targetEntity: Toppings::class)]
#[ORM\JoinTable(name: 'food_item_toppings')]
private Collection $toppings;
public function __construct()
{
$this->toppings = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getOrderId(): ?int
{
return $this->orderId;
}
public function setOrderId(int $orderId): self
{
$this->orderId = $orderId;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getPosId(): ?string
{
return $this->pos_id;
}
public function setPosId(string $pos_id): self
{
$this->pos_id = $pos_id;
return $this;
}
public function getPosId1050(): ?string
{
return $this->pos_id_1050;
}
public function getPosId10202(): ?string
{
return $this->pos_id_10202;
}
public function setPosId1050(string $pos_id_1050): self
{
$this->pos_id_1050 = $pos_id_1050;
return $this;
}
public function setPosId10202(string $pos_id_10202): self
{
$this->pos_id_10202 = $pos_id_10202;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getIsActive(): bool
{
return $this->is_active;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(string $image): self
{
$this->image = $image;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
public function getCategory(): ?FoodCategory
{
return $this->category;
}
public function setCategory(?FoodCategory $category): self
{
$this->category = $category;
return $this;
}
public function setIsActive(bool $is_active): self
{
$this->is_active = $is_active;
return $this;
}
/**
* @return Collection|Toppings[]
*/
public function getToppings(): Collection
{
return $this->toppings;
}
public function addTopping(Toppings $topping): self
{
if (!$this->toppings->contains($topping)) {
$this->toppings[] = $topping;
}
return $this;
}
public function removeTopping(Toppings $topping): self
{
$this->toppings->removeElement($topping);
return $this;
}
}