src/Entity/Products.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use App\Repository\ProductsRepository;
  8.  
  9. #[ORM\Entity(repositoryClassProductsRepository::class)]
  10. #[ORM\Table(name"products"indexes: [
  11.   
  12. ])]
  13. class Products
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue(strategy"IDENTITY")]
  17.     #[ORM\Column(name"id"type"integer")]
  18.     private ?int $id null;
  19.     #[Assert\NotBlank]
  20.     #[ORM\Column(name"prix"type"integer")]
  21.     private ?string $prix null;
  22.  
  23.  
  24.     #[Assert\NotBlank]
  25.     #[ORM\Column(name"title"type"string"length255nullabletrue)]
  26.     private ?string $title null;
  27.     #[Assert\NotBlank]
  28.     #[ORM\Column(name"image"type"string"length255nullabletrue)]
  29.     private ?string $image null;
  30.     #[Assert\NotBlank]
  31.     #[ORM\Column(name"description"type"string"length255nullabletrue)]
  32.     private ?string $description null;
  33.     #[Assert\NotBlank]
  34.     #[ORM\Column(name"tags"type"string"length255nullabletrue)]
  35.     private ?string $tags null;
  36.     
  37.     
  38.     #[ORM\OneToMany(targetEntity:CartItems::class, mappedBy:"productId")]
  39.     private Collection $cartItems;
  40.     public function __construct() {
  41.         $this->cartItems = new ArrayCollection();
  42.  
  43.     }
  44.     public function getCartItems(): Collection
  45.     {
  46.         return $this->cartItems;
  47.     }
  48.  
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getPrix(): ?int
  54.     {
  55.         return $this->prix;
  56.     }
  57.     
  58.     public function setPrix(int $prix): static
  59.     {
  60.         $this->prix $prix;
  61.         return $this;
  62.     }
  63.     public function getTitle(): ?string
  64.     {
  65.         return $this->title;
  66.     }
  67.     public function setTitle(?string $title): static
  68.     {
  69.         $this->title $title;
  70.         return $this;
  71.     }
  72.    
  73.     public function getImage(): ?string
  74.     {
  75.         return $this->image;
  76.     }
  77.     public function setImage(?string $image): static
  78.     {
  79.         $this->image $image;
  80.         return $this;
  81.     }
  82.    
  83.     public function getDescription(): ?string
  84.     {
  85.         return $this->description;
  86.     }
  87.     public function setDescription(?string $description): static
  88.     {
  89.         $this->description $description;
  90.         return $this;
  91.     }
  92.  
  93.     public function getTags(): ?string
  94.     {
  95.         return $this->tags;
  96.     }
  97.     public function setTags(?string $tags): static
  98.     {
  99.         $this->tags $tags;
  100.         return $this;
  101.     }
  102. }