<?php
namespace App\Entity;
use App\Traits\Activeable;
use App\Traits\Creatable;
use App\Traits\Deleteable;
use App\Traits\Updateable;
use DateTime;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\ComponentRepository")
* @ORM\Table(name="`dish`")
* @Gedmo\SoftDeleteable(fieldName="deletedAt")
*/
class Dish
{
use Creatable, Updateable, Activeable, Deleteable;
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id = null;
/**
* @ORM\OneToMany(targetEntity="App\Entity\DishTranslation", mappedBy="dish", cascade={"remove", "persist"})
*/
private Collection $dishTranslations;
/**
* @var ?int
*
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $sellingPriceTtc = null;
/**
* @var ?int
*
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $reducedPrice = null;
/**
* @var ?DateTime
*
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTime $reducedPriceStart = null;
/**
* @var ?DateTime
*
* @ORM\Column(type="datetime", nullable=true)
*/
private ?DateTime $reducedPriceEnd = null;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Document", cascade={"persist"})
*/
private ?Document $image = null;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\DishCategory", inversedBy="dishes")
*/
private ?DishCategory $dishCategory = null;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Allergen", inversedBy="dishes")
* @ORM\JoinTable(name="dishes_allergens")
*/
private Collection $allergens;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Label", inversedBy="dishes")
* @ORM\OrderBy({"position" = "ASC"})
*/
private Collection $labels;
/**
* @ORM\OneToMany(targetEntity="App\Entity\WinePairing", mappedBy="dish", cascade={"persist", "remove"})
*/
private Collection $winePairings;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BeerPairing", mappedBy="dish", cascade={"persist", "remove"})
*/
private Collection $beerPairings;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Institution", inversedBy="dishes")
*/
private ?Institution $institution = null;
/**
* @var ?int
*
* @ORM\Column(name="position", type="integer", nullable=true)
*/
private ?int $position = null;
/**
* @var ?bool
*
* @ORM\Column(name="highlight", type="boolean", nullable=true)
*/
private ?bool $highlight = null;
public function __construct()
{
$this->allergens = new ArrayCollection();
$this->labels = new ArrayCollection();
$this->winePairings = new ArrayCollection();
$this->beerPairings = new ArrayCollection();
$this->dishTranslations = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection|DishTranslation[]
*/
public function getDishTranslations(): Collection|array
{
return $this->dishTranslations;
}
public function addDishTranslation(DishTranslation $dishTranslation): self
{
if (!$this->dishTranslations->contains($dishTranslation)) {
$this->dishTranslations[] = $dishTranslation;
$dishTranslation->setDish($this);
}
return $this;
}
public function removeDishTranslation(DishTranslation $dishTranslation): self
{
if ($this->dishTranslations->removeElement($dishTranslation)) {
// set the owning side to null (unless already changed)
if ($dishTranslation->getDish() === $this) {
$dishTranslation->setDish(null);
}
}
return $this;
}
public function getSellingPriceTtc(): ?int
{
return $this->sellingPriceTtc;
}
public function setSellingPriceTtc(?int $sellingPriceTtc): self
{
$this->sellingPriceTtc = $sellingPriceTtc;
return $this;
}
public function getReducedPrice(): ?int
{
return $this->reducedPrice;
}
public function setReducedPrice(?int $reducedPrice): self
{
$this->reducedPrice = $reducedPrice;
return $this;
}
public function getReducedPriceStart(): ?DateTimeInterface
{
return $this->reducedPriceStart;
}
public function setReducedPriceStart(?DateTimeInterface $reducedPriceStart): self
{
$this->reducedPriceStart = $reducedPriceStart;
return $this;
}
public function getReducedPriceEnd(): ?DateTimeInterface
{
return $this->reducedPriceEnd;
}
public function setReducedPriceEnd(?DateTimeInterface $reducedPriceEnd): self
{
$this->reducedPriceEnd = $reducedPriceEnd;
return $this;
}
public function getImage(): ?Document
{
return $this->image;
}
public function setImage(?Document $image): self
{
$this->image = $image;
return $this;
}
public function getDishCategory(): ?DishCategory
{
return $this->dishCategory;
}
public function setDishCategory(?DishCategory $dishCategory): self
{
$this->dishCategory = $dishCategory;
return $this;
}
/**
* @return Collection|Allergen[]
*/
public function getAllergens(): Collection|array
{
return $this->allergens;
}
public function addAllergen(Allergen $allergen): self
{
if (!$this->allergens->contains($allergen)) {
$this->allergens[] = $allergen;
}
return $this;
}
public function removeAllergen(Allergen $allergen): self
{
if ($this->allergens->contains($allergen)) {
$this->allergens->removeElement($allergen);
}
return $this;
}
/**
* @return Collection|Label[]
*/
public function getLabels(): Collection|array
{
return $this->labels;
}
public function addLabel(Label $label): self
{
if (!$this->labels->contains($label)) {
$this->labels[] = $label;
}
return $this;
}
public function removeLabel(Label $label): self
{
if ($this->labels->contains($label)) {
$this->labels->removeElement($label);
}
return $this;
}
/**
* @return Collection|WinePairing[]
*/
public function getWinePairings(): array|Collection
{
return $this->winePairings;
}
public function addWinePairing(WinePairing $winePairing): self
{
if (!$this->winePairings->contains($winePairing)) {
$this->winePairings[] = $winePairing;
$winePairing->setDish($this);
}
return $this;
}
public function removeWinePairing(WinePairing $winePairing): self
{
if ($this->winePairings->contains($winePairing)) {
$this->winePairings->removeElement($winePairing);
// set the owning side to null (unless already changed)
if ($winePairing->getDish() === $this) {
$winePairing->setDish(null);
}
}
return $this;
}
/**
* @return Collection|BeerPairing[]
*/
public function getBeerPairings(): array|Collection
{
return $this->beerPairings;
}
public function addBeerPairing(BeerPairing $beerPairing): self
{
if (!$this->beerPairings->contains($beerPairing)) {
$this->beerPairings[] = $beerPairing;
$beerPairing->setDish($this);
}
return $this;
}
public function removeBeerPairing(BeerPairing $beerPairing): self
{
if ($this->beerPairings->contains($beerPairing)) {
$this->beerPairings->removeElement($beerPairing);
// set the owning side to null (unless already changed)
if ($beerPairing->getDish() === $this) {
$beerPairing->setDish(null);
}
}
return $this;
}
public function getInstitution(): ?Institution
{
return $this->institution;
}
public function setInstitution(?Institution $institution): self
{
$this->institution = $institution;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
public function getHighlight(): ?bool
{
return $this->highlight;
}
public function setHighlight(?bool $highlight): self
{
$this->highlight = $highlight;
return $this;
}
}