src/Entity/Menu.php line 15
<?phpnamespace App\Entity;use App\Repository\MenuRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Uid\Uuid;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: MenuRepository::class)]class Menu{#[ORM\Id]#[ORM\Column(type: 'uuid', unique: true)]#[Groups(['BASE'])]private ?string $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\ManyToOne(inversedBy: 'menus')]#[ORM\JoinColumn(nullable: false)]private ?Whitelabel $whitelabel = null;#[ORM\ManyToOne(inversedBy: 'menus')]#[ORM\JoinColumn(nullable: false)]private ?User $creatorUser = null;#[ORM\ManyToOne(inversedBy: 'menus')]#[ORM\JoinColumn(nullable: true)]private ?Property $property = null;#[ORM\Column(length: 255, nullable: true)]private ?string $templateName = null;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $createDate = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $fromDate = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $toDate = null;#[ORM\ManyToMany(targetEntity: Product::class, inversedBy: 'menus')]private Collection $products;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $sendNotificationDate = null;#[ORM\OneToMany(mappedBy: 'menu', targetEntity: NotificationHistory::class, orphanRemoval: true)]private Collection $notificationHistories;#[ORM\ManyToMany(targetEntity: File::class, inversedBy: 'menus')]private Collection $files;#[Assert\Choice(choices: [\App\Repository\MenuRepository::TYPE_MENU_LUNCH, \App\Repository\MenuRepository::TYPE_MENU_MAIN, \App\Repository\MenuRepository::TYPE_MENU_CATERING], message: 'Choose a valid type.')]#[ORM\Column(nullable: true)]private ?int $type = null;#[ORM\Column(options: ['default' => true])]private bool $isPublished = true;public function __construct(){$this->id = Uuid::v4();$this->products = new ArrayCollection();$this->notificationHistories = new ArrayCollection();$this->files = new ArrayCollection();}public function getId(): ?string{return $this->id;}public function setId(string $id): self{$this->id = $id;return $this;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getTemplateName(): ?string{return $this->templateName;}public function setTemplateName(string $templateName): self{$this->templateName = $templateName;return $this;}public function getType(): ?int{return $this->type;}public function setType(int $type): self{$this->type = $type;return $this;}public function getWhitelabel(): ?Whitelabel{return $this->whitelabel;}public function setWhitelabel(?Whitelabel $whitelabel): self{$this->whitelabel = $whitelabel;return $this;}public function getProperty(): ?Property{return $this->property;}public function setProperty(?Property $property): self{$this->property = $property;return $this;}public function getCreatorUser(): ?User{return $this->creatorUser;}public function setCreatorUser(?User $creatorUser): self{$this->creatorUser = $creatorUser;return $this;}public function getCreateDate(): ?\DateTimeInterface{return $this->createDate;}public function setCreateDate(\DateTimeInterface $createDate): self{$this->createDate = $createDate;return $this;}public function getFromDate(): ?\DateTimeInterface{return $this->fromDate;}public function setFromDate(?\DateTimeInterface $fromDate): self{$this->fromDate = $fromDate;return $this;}public function getToDate(): ?\DateTimeInterface{return $this->toDate;}public function setToDate(?\DateTimeInterface $toDate): self{$this->toDate = $toDate;return $this;}/*** @return Collection<int, Product>*/public function getProducts(): Collection{return $this->products;}public function addProduct(Product $product): self{if (!$this->products->contains($product)) {$this->products->add($product);}return $this;}public function removeProduct(Product $product): self{$this->products->removeElement($product);return $this;}public function getSendNotificationDate(): ?\DateTimeInterface{return $this->sendNotificationDate;}public function setSendNotificationDate(?\DateTimeInterface $sendNotificationDate): self{$this->sendNotificationDate = $sendNotificationDate;return $this;}/*** @return Collection<int, NotificationHistory>*/public function getNotificationHistories(): Collection{return $this->notificationHistories;}public function addNotificationHistory(NotificationHistory $notificationHistory): self{if (!$this->notificationHistories->contains($notificationHistory)) {$this->notificationHistories->add($notificationHistory);$notificationHistory->setMenu($this);}return $this;}public function removeNotificationHistory(NotificationHistory $notificationHistory): self{if ($this->notificationHistories->removeElement($notificationHistory)) {// set the owning side to null (unless already changed)if ($notificationHistory->getMenu() === $this) {$notificationHistory->setMenu(null);}}return $this;}public function isIsPublished(): bool{return $this->isPublished;}public function setIsPublished(bool $isPublished): self{$this->isPublished = $isPublished;return $this;}/*** @return Collection<int, File>*/public function getFiles(): Collection{return $this->files;}public function addFile(File $file): static{if (!$this->files->contains($file)) {$this->files->add($file);}return $this;}public function removeFile(File $file): static{$this->files->removeElement($file);return $this;}}