<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Trait\TimestampableTrait;
use App\Repository\ProduitRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Entity(repositoryClass: ProduitRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Produit
{
use TimestampableTrait;
/* #[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id; */
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'text', nullable: true)]
private $description;
#[ORM\Column(type: 'float', nullable: true)]
private $price;
/* #[ORM\ManyToOne(targetEntity: Sousmenu::class, inversedBy: 'produits')]
private $sousmenu; */
#[ORM\Column(type: 'json', nullable: true)]
private $image = [];
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'produits')]
private $category;
/* #[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $createdAt;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $updatedAt;
*/
/* #[ORM\OneToMany(mappedBy: 'produit', targetEntity: OrderItem::class)]
private $orderItems;
public function __construct()
{
$this->orderItems = new ArrayCollection();
} */
/* public function getId(): ?int
{
return $this->id;
}
*/
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(?float $price): self
{
$this->price = $price;
return $this;
}
/* public function getSousmenu(): ?Sousmenu
{
return $this->sousmenu;
}
public function setSousmenu(?Sousmenu $sousmenu): self
{
$this->sousmenu = $sousmenu;
return $this;
} */
public function getImage(): ?array
{
return $this->image;
}
public function setImage(?array $image): self
{
$this->image = $image;
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;
}
*//*
/**
* @return Collection<int, OrderItem>
/
public function getOrderItems(): Collection
{
return $this->orderItems;
}
public function addOrderItem(OrderItem $orderItem): self
{
if (!$this->orderItems->contains($orderItem)) {
$this->orderItems[] = $orderItem;
$orderItem->setProduit($this);
}
return $this;
}
public function removeOrderItem(OrderItem $orderItem): self
{
if ($this->orderItems->removeElement($orderItem)) {
// set the owning side to null (unless already changed)
if ($orderItem->getProduit() === $this) {
$orderItem->setProduit(null);
}
}
return $this;
} */
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
}