src/Entity/Product.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\ProductRepository;
  6. use DateTimeImmutable;
  7. use DateTimeInterface;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @author Gloire Kafwalubi on 21/10/2023 - 1:27 AM
  12.  * <gloirekaf.mwansha@gmail.com>
  13.  *
  14.  */
  15. #[ORM\Entity(repositoryClassProductRepository::class)]
  16. #[ApiResource]
  17. class Product
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[ORM\Column(length255)]
  24.     private ?string $name null;
  25.     #[ORM\Column(typeTypes::TEXT)]
  26.     private ?string $description null;
  27.     #[ORM\Column]
  28.     private ?float $price null;
  29.     #[ORM\Column(length255)]
  30.     private ?string $cover null;
  31.     #[ORM\Column]
  32.     private ?DateTimeImmutable $created_at null;
  33.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  34.     private ?DateTimeInterface $updated_at null;
  35.     #[ORM\Column]
  36.     private ?float $quantity null;
  37.     #[ORM\Column(length255)]
  38.     private ?string $unity null;
  39.     #[ORM\ManyToOne(inversedBy'products')]
  40.     private ?Prescription $prescription null;
  41.     #[ORM\ManyToOne(inversedBy'product')]
  42.     private ?Order $commande null;
  43.     #[ORM\ManyToOne(inversedBy'products')]
  44.     private ?User $pharmacy null;
  45.     public function __construct()
  46.     {
  47.         $this->created_at = new DateTimeImmutable();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): static
  58.     {
  59.         $this->name $name;
  60.         return $this;
  61.     }
  62.     public function getDescription(): ?string
  63.     {
  64.         return $this->description;
  65.     }
  66.     public function setDescription(string $description): static
  67.     {
  68.         $this->description $description;
  69.         return $this;
  70.     }
  71.     public function getPrice(): ?float
  72.     {
  73.         return $this->price;
  74.     }
  75.     public function setPrice(float $price): static
  76.     {
  77.         $this->price $price;
  78.         return $this;
  79.     }
  80.     public function getCover(): ?string
  81.     {
  82.         return $this->cover;
  83.     }
  84.     public function setCover(string $cover): static
  85.     {
  86.         $this->cover $cover;
  87.         return $this;
  88.     }
  89.     public function getCreatedAt(): ?DateTimeImmutable
  90.     {
  91.         return $this->created_at;
  92.     }
  93.     public function setCreatedAt(DateTimeImmutable $created_at): static
  94.     {
  95.         $this->created_at $created_at;
  96.         return $this;
  97.     }
  98.     public function getUpdatedAt(): ?DateTimeInterface
  99.     {
  100.         return $this->updated_at;
  101.     }
  102.     public function setUpdatedAt(?DateTimeInterface $updated_at): static
  103.     {
  104.         $this->updated_at $updated_at;
  105.         return $this;
  106.     }
  107.     public function getQuantity(): ?float
  108.     {
  109.         return $this->quantity;
  110.     }
  111.     public function setQuantity(float $quantity): static
  112.     {
  113.         $this->quantity $quantity;
  114.         return $this;
  115.     }
  116.     public function getUnity(): ?string
  117.     {
  118.         return $this->unity;
  119.     }
  120.     public function setUnity(string $unity): static
  121.     {
  122.         $this->unity $unity;
  123.         return $this;
  124.     }
  125.     public function getPrescription(): ?Prescription
  126.     {
  127.         return $this->prescription;
  128.     }
  129.     public function setPrescription(?Prescription $prescription): static
  130.     {
  131.         $this->prescription $prescription;
  132.         return $this;
  133.     }
  134.     public function getCommande(): ?Order
  135.     {
  136.         return $this->commande;
  137.     }
  138.     public function setCommande(?Order $commande): static
  139.     {
  140.         $this->commande $commande;
  141.         return $this;
  142.     }
  143.     public function getPharmacy(): ?User
  144.     {
  145.         return $this->pharmacy;
  146.     }
  147.     public function setPharmacy(?User $pharmacy): static
  148.     {
  149.         $this->pharmacy $pharmacy;
  150.         return $this;
  151.     }
  152. }