<?php
namespace App\Entity;
use App\Repository\HtMenuRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=HtMenuRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class HtMenu
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups("htmenu:read")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity=Escandallo::class, inversedBy="htMenus")
*/
private $escandallo;
/**
* @ORM\Column(type="float")
*/
private $beneficio;
/**
* @ORM\Column(type="float")
*/
private $totalPrice;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $updatedAt;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private $createdId;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
*/
private $updatedId;
/**
* @ORM\Column(type="boolean")
*/
private $template;
/**
* @ORM\Column(type="string", length=255)
* @Groups("htmenu:read")
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity=HtItem::class, inversedBy="htMenu", cascade={"persist"})
*/
private $htItem;
/**
* @ORM\Column(type="float")
*/
private $iva;
/**
* @ORM\OneToMany(targetEntity=HtExtra::class, mappedBy="htMenu", cascade={"persist", "remove"})
*/
private $htExtras;
public function __construct()
{
$this->escandallo = new ArrayCollection();
$this->htExtras = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id = null): self
{
$this->id = $id;
return $this;
}
/**
* @return Collection<int, Escandallo>
*/
public function getEscandallo(): Collection
{
return $this->escandallo;
}
public function addEscandallo(Escandallo $escandallo): self
{
if (!$this->escandallo->contains($escandallo)) {
$this->escandallo[] = $escandallo;
}
return $this;
}
public function removeEscandallo(Escandallo $escandallo): self
{
$this->escandallo->removeElement($escandallo);
return $this;
}
public function getBeneficio(): ?float
{
return $this->beneficio;
}
public function setBeneficio(float $beneficio): self
{
$this->beneficio = $beneficio;
return $this;
}
public function getTotalPrice(): ?float
{
return $this->totalPrice;
}
public function setTotalPrice(float $totalPrice): self
{
$this->totalPrice = $totalPrice;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue()
{
$this->createdAt = new \DateTimeImmutable();
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function setUpdatedAtValue()
{
$this->updatedAt = new \DateTimeImmutable();
}
public function getCreatedId(): ?User
{
return $this->createdId;
}
public function setCreatedId(?User $createdId): self
{
$this->createdId = $createdId;
return $this;
}
public function getUpdatedId(): ?User
{
return $this->updatedId;
}
public function setUpdatedId(?User $updatedId): self
{
$this->updatedId = $updatedId;
return $this;
}
public function isTemplate(): ?bool
{
return $this->template;
}
public function setTemplate(bool $template): self
{
$this->template = $template;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getHtItem(): ?HtItem
{
return $this->htItem;
}
public function setHtItem(?HtItem $htItem): self
{
$this->htItem = $htItem;
return $this;
}
public function getIva(): ?float
{
return $this->iva;
}
public function setIva(float $iva): self
{
$this->iva = $iva;
return $this;
}
/**
* @return Collection<int, HtExtra>
*/
public function getHtExtras(): Collection
{
return $this->htExtras;
}
public function addHtExtra(HtExtra $htExtra): self
{
if (!$this->htExtras->contains($htExtra)) {
$this->htExtras[] = $htExtra;
$htExtra->setHtMenu($this);
}
return $this;
}
public function removeHtExtra(HtExtra $htExtra): self
{
if ($this->htExtras->removeElement($htExtra)) {
// set the owning side to null (unless already changed)
if ($htExtra->getHtMenu() === $this) {
$htExtra->setHtMenu(null);
}
}
return $this;
}
}