<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\PrescriptionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PrescriptionRepository::class)]
#[ApiResource]
class Prescription
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $code = null;
#[ORM\ManyToOne(inversedBy: 'prescriptions')]
private ?User $patient = null;
#[ORM\ManyToOne(inversedBy: 'prescriptions')]
private ?User $doctor = null;
#[ORM\Column(length: 255)]
private ?string $medecine = null;
#[ORM\Column(length: 255)]
private ?string $unit = null;
#[ORM\Column(length: 255)]
private ?string $frequency = null;
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
private ?\DateTimeInterface $presciption_at = null;
#[ORM\Column]
private ?float $quantity = null;
#[ORM\Column]
private ?int $during = null;
#[ORM\Column]
private ?\DateTimeImmutable $created_at = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $updated_at = null;
public function __construct()
{
$this->presciption_at = new \DateTimeImmutable();
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): static
{
$this->code = $code;
return $this;
}
public function getPatient(): ?User
{
return $this->patient;
}
public function setPatient(?User $patient): static
{
$this->patient = $patient;
return $this;
}
public function getDoctor(): ?User
{
return $this->doctor;
}
public function setDoctor(?User $doctor): static
{
$this->doctor = $doctor;
return $this;
}
public function getMedecine(): ?string
{
return $this->medecine;
}
public function setMedecine(string $medecine): static
{
$this->medecine = $medecine;
return $this;
}
public function getUnit(): ?string
{
return $this->unit;
}
public function setUnit(string $unit): static
{
$this->unit = $unit;
return $this;
}
public function getFrequency(): ?string
{
return $this->frequency;
}
public function setFrequency(string $frequency): static
{
$this->frequency = $frequency;
return $this;
}
public function getPresciptionAt(): ?\DateTimeInterface
{
return $this->presciption_at;
}
public function setPresciptionAt(\DateTimeInterface $presciption_at): static
{
$this->presciption_at = $presciption_at;
return $this;
}
public function getQuantity(): ?float
{
return $this->quantity;
}
public function setQuantity(float $quantity): static
{
$this->quantity = $quantity;
return $this;
}
public function getDuring(): ?int
{
return $this->during;
}
public function setDuring(int $during): static
{
$this->during = $during;
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(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(?\DateTimeImmutable $updated_at): static
{
$this->updated_at = $updated_at;
return $this;
}
}