src/Entity/Produit.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Trait\TimestampableTrait;
  5. use App\Repository\ProduitRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. #[ORM\Entity(repositoryClassProduitRepository::class)]
  9. #[ORM\HasLifecycleCallbacks]
  10. class Produit
  11. {
  12.     use TimestampableTrait;
  13.     /* #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type: 'integer')]
  16.     private $id; */
  17.     #[ORM\Column(type'string'length255)]
  18.     private $name;
  19.     #[ORM\Column(type'text'nullabletrue)]
  20.     private $description;
  21.     #[ORM\Column(type'float'nullabletrue)]
  22.     private $price;
  23.    /*  #[ORM\ManyToOne(targetEntity: Sousmenu::class, inversedBy: 'produits')]
  24.     private $sousmenu; */
  25.     #[ORM\Column(type'json'nullabletrue)]
  26.     private $image = [];
  27.     
  28.     #[ORM\ManyToOne(targetEntityCategory::class, inversedBy'produits')]
  29.     private $category;
  30.    /*  #[ORM\Column(type: 'datetime_immutable', nullable: true)]
  31.     private $createdAt;
  32.     #[ORM\Column(type: 'datetime_immutable', nullable: true)]
  33.     private $updatedAt;
  34.  */
  35.     /* #[ORM\OneToMany(mappedBy: 'produit', targetEntity: OrderItem::class)]
  36.     private $orderItems;
  37.     public function __construct()
  38.     {
  39.         $this->orderItems = new ArrayCollection();
  40.     } */
  41.     /* public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.  */
  46.     public function getName(): ?string
  47.     {
  48.         return $this->name;
  49.     }
  50.     public function setName(string $name): self
  51.     {
  52.         $this->name $name;
  53.         return $this;
  54.     }
  55.     public function getDescription(): ?string
  56.     {
  57.         return $this->description;
  58.     }
  59.     public function setDescription(?string $description): self
  60.     {
  61.         $this->description $description;
  62.         return $this;
  63.     }
  64.     public function getPrice(): ?float
  65.     {
  66.         return $this->price;
  67.     }
  68.     public function setPrice(?float $price): self
  69.     {
  70.         $this->price $price;
  71.         return $this;
  72.     }
  73.    /*  public function getSousmenu(): ?Sousmenu
  74.     {
  75.         return $this->sousmenu;
  76.     }
  77.     public function setSousmenu(?Sousmenu $sousmenu): self
  78.     {
  79.         $this->sousmenu = $sousmenu;
  80.         return $this;
  81.     } */
  82.     public function getImage(): ?array
  83.     {
  84.         return $this->image;
  85.     }
  86.     public function setImage(?array $image): self
  87.     {
  88.         $this->image $image;
  89.         return $this;
  90.     }
  91.     /* public function getCreatedAt(): ?\DateTimeImmutable
  92.     {
  93.         return $this->createdAt;
  94.     }
  95.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  96.     {
  97.         $this->createdAt = $createdAt;
  98.         return $this;
  99.     }
  100.     public function getUpdatedAt(): ?\DateTimeImmutable
  101.     {
  102.         return $this->updatedAt;
  103.     }
  104.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  105.     {
  106.         $this->updatedAt = $updatedAt;
  107.         return $this;
  108.     }
  109.  *//* 
  110.     /**
  111.      * @return Collection<int, OrderItem>
  112.      /
  113.     public function getOrderItems(): Collection
  114.     {
  115.         return $this->orderItems;
  116.     }
  117.     public function addOrderItem(OrderItem $orderItem): self
  118.     {
  119.         if (!$this->orderItems->contains($orderItem)) {
  120.             $this->orderItems[] = $orderItem;
  121.             $orderItem->setProduit($this);
  122.         }
  123.         return $this;
  124.     }
  125.     public function removeOrderItem(OrderItem $orderItem): self
  126.     {
  127.         if ($this->orderItems->removeElement($orderItem)) {
  128.             // set the owning side to null (unless already changed)
  129.             if ($orderItem->getProduit() === $this) {
  130.                 $orderItem->setProduit(null);
  131.             }
  132.         }
  133.         return $this;
  134.     } */
  135.     public function getCategory(): ?Category
  136.     {
  137.         return $this->category;
  138.     }
  139.     public function setCategory(?Category $category): self
  140.     {
  141.         $this->category $category;
  142.         return $this;
  143.     }
  144. }