src/Entity/FoodItem.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Toppings;
  4. use App\Entity\FoodCategory;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use App\Repository\FoodItemRepository;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. #[ORM\Entity(repositoryClassFoodItemRepository::class)]
  10. class FoodItem
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private ?int $id null;
  16.     #[ORM\Column(type'integer')]
  17.     private ?int $orderId null;
  18.     #[ORM\Column(type'string'length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(type'string'length255)]
  21.     private ?string $pos_id null;
  22.     #[ORM\Column(type'string'length255)]
  23.     private ?string $pos_id_1050 null;
  24.     #[ORM\Column(type'string'length255)]
  25.     private ?string $pos_id_10202 null;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private ?string $image null;
  28.     #[ORM\Column(type'float')]
  29.     private ?float $price null;
  30.     #[ORM\Column(type'boolean')]
  31.     private bool $is_active true;
  32.     #[ORM\Column(type'string'length255)]
  33.     private ?string $description null;
  34.     #[ORM\ManyToOne(targetEntityFoodCategory::class, inversedBy'foodItems')]
  35.     #[ORM\JoinColumn(nullablefalse)]
  36.     private ?FoodCategory $category null;
  37.     #[ORM\ManyToMany(targetEntityToppings::class)]
  38.     #[ORM\JoinTable(name'food_item_toppings')]
  39.     private Collection $toppings;
  40.     public function __construct()
  41.     {
  42.         $this->toppings = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getOrderId(): ?int
  49.     {
  50.         return $this->orderId;
  51.     }
  52.     public function setOrderId(int $orderId): self
  53.     {
  54.         $this->orderId $orderId;
  55.         return $this;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(string $name): self
  62.     {
  63.         $this->name $name;
  64.         return $this;
  65.     }
  66.     public function getPosId(): ?string
  67.     {
  68.         return $this->pos_id;
  69.     }
  70.     public function setPosId(string $pos_id): self
  71.     {
  72.         $this->pos_id $pos_id;
  73.         return $this;
  74.     }
  75.     public function getPosId1050(): ?string
  76.     {
  77.         return $this->pos_id_1050;
  78.     }
  79.     public function getPosId10202(): ?string
  80.     {
  81.         return $this->pos_id_10202;
  82.     }
  83.     public function setPosId1050(string $pos_id_1050): self
  84.     {
  85.         $this->pos_id_1050 $pos_id_1050;
  86.         return $this;
  87.     }
  88.     public function setPosId10202(string $pos_id_10202): self
  89.     {
  90.         $this->pos_id_10202 $pos_id_10202;
  91.         return $this;
  92.     }
  93.     public function getDescription(): ?string
  94.     {
  95.         return $this->description;
  96.     }
  97.     public function setDescription(string $description): self
  98.     {
  99.         $this->description $description;
  100.         return $this;
  101.     }
  102.     public function getIsActive(): bool
  103.     {
  104.         return $this->is_active;
  105.     }
  106.     public function getImage(): ?string
  107.     {
  108.         return $this->image;
  109.     }
  110.     public function setImage(string $image): self
  111.     {
  112.         $this->image $image;
  113.         return $this;
  114.     }
  115.     public function getPrice(): ?float
  116.     {
  117.         return $this->price;
  118.     }
  119.     public function setPrice(float $price): self
  120.     {
  121.         $this->price $price;
  122.         return $this;
  123.     }
  124.     public function getCategory(): ?FoodCategory
  125.     {
  126.         return $this->category;
  127.     }
  128.     public function setCategory(?FoodCategory $category): self
  129.     {
  130.         $this->category $category;
  131.         return $this;
  132.     }
  133.     public function setIsActive(bool $is_active): self
  134.     {
  135.         $this->is_active $is_active;
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection|Toppings[]
  140.      */
  141.     public function getToppings(): Collection
  142.     {
  143.         return $this->toppings;
  144.     }
  145.     public function addTopping(Toppings $topping): self
  146.     {
  147.         if (!$this->toppings->contains($topping)) {
  148.             $this->toppings[] = $topping;
  149.         }
  150.         return $this;
  151.     }
  152.     public function removeTopping(Toppings $topping): self
  153.     {
  154.         $this->toppings->removeElement($topping);
  155.         return $this;
  156.     }
  157. }