<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\ProductRepository;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @author Gloire Kafwalubi on 21/10/2023 - 1:27 AM
* <gloirekaf.mwansha@gmail.com>
*
*/
#[ORM\Entity(repositoryClass: ProductRepository::class)]
#[ApiResource]
class Product
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column]
private ?float $price = null;
#[ORM\Column(length: 255)]
private ?string $cover = null;
#[ORM\Column]
private ?DateTimeImmutable $created_at = null;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?DateTimeInterface $updated_at = null;
#[ORM\Column]
private ?float $quantity = null;
#[ORM\Column(length: 255)]
private ?string $unity = null;
#[ORM\ManyToOne(inversedBy: 'products')]
private ?Prescription $prescription = null;
#[ORM\ManyToOne(inversedBy: 'product')]
private ?Order $commande = null;
#[ORM\ManyToOne(inversedBy: 'products')]
private ?User $pharmacy = null;
public function __construct()
{
$this->created_at = new DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): static
{
$this->description = $description;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): static
{
$this->price = $price;
return $this;
}
public function getCover(): ?string
{
return $this->cover;
}
public function setCover(string $cover): static
{
$this->cover = $cover;
return $this;
}
public function getCreatedAt(): ?DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(DateTimeImmutable $created_at): static
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?DateTimeInterface
{
return $this->updated_at;
}
public function setUpdatedAt(?DateTimeInterface $updated_at): static
{
$this->updated_at = $updated_at;
return $this;
}
public function getQuantity(): ?float
{
return $this->quantity;
}
public function setQuantity(float $quantity): static
{
$this->quantity = $quantity;
return $this;
}
public function getUnity(): ?string
{
return $this->unity;
}
public function setUnity(string $unity): static
{
$this->unity = $unity;
return $this;
}
public function getPrescription(): ?Prescription
{
return $this->prescription;
}
public function setPrescription(?Prescription $prescription): static
{
$this->prescription = $prescription;
return $this;
}
public function getCommande(): ?Order
{
return $this->commande;
}
public function setCommande(?Order $commande): static
{
$this->commande = $commande;
return $this;
}
public function getPharmacy(): ?User
{
return $this->pharmacy;
}
public function setPharmacy(?User $pharmacy): static
{
$this->pharmacy = $pharmacy;
return $this;
}
}