<?php
namespace App\Entity;
use App\Repository\BasketsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BasketsRepository::class)]
class Baskets
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\ManyToOne(targetEntity: Clinics::class, inversedBy: 'baskets')]
private $clinic;
#[ORM\Column(type: 'float', nullable: true)]
private $total;
#[ORM\Column(type: 'string', length: 255)]
private $name;
#[ORM\Column(type: 'string', length: 255)]
private $savedBy;
#[ORM\Column(type: 'string', length: 255)]
private $status;
#[ORM\Column(type: 'datetime')]
private $modified;
#[ORM\Column(type: 'datetime')]
private $created;
#[ORM\OneToMany(targetEntity: BasketItems::class, mappedBy: 'basket')]
private $basketItems;
#[ORM\OneToOne(targetEntity: Orders::class, mappedBy: 'basket', cascade: ['persist', 'remove'])]
private $orders;
#[ORM\Column(type: 'integer', nullable: true)]
private $isDefault;
public function __construct()
{
$this->setModified(new \DateTime());
if ($this->getCreated() == null) {
$this->setCreated(new \DateTime());
}
$this->basketItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getClinic(): ?Clinics
{
return $this->clinic;
}
public function setClinic(?Clinics $clinic): self
{
$this->clinic = $clinic;
return $this;
}
public function getTotal(): ?float
{
return $this->total;
}
public function setTotal(?float $total): self
{
$this->total = $total;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSavedBy(): ?string
{
return $this->savedBy;
}
public function setSavedBy(string $savedBy): self
{
$this->savedBy = $savedBy;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function setModified(\DateTimeInterface $modified): self
{
$this->modified = $modified;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
/**
* @return Collection<int, BasketItems>
*/
public function getBasketItems(): Collection
{
return $this->basketItems;
}
public function addBasketItem(BasketItems $basketItem): self
{
if (!$this->basketItems->contains($basketItem)) {
$this->basketItems[] = $basketItem;
$basketItem->setBasket($this);
}
return $this;
}
public function removeBasketItem(BasketItems $basketItem): self
{
if ($this->basketItems->removeElement($basketItem)) {
// set the owning side to null (unless already changed)
if ($basketItem->getBasket() === $this) {
$basketItem->setBasket(null);
}
}
return $this;
}
public function getOrders(): ?Orders
{
return $this->orders;
}
public function setOrders(Orders $orders): self
{
// set the owning side of the relation if necessary
if ($orders->getBasket() !== $this) {
$orders->setBasket($this);
}
$this->orders = $orders;
return $this;
}
public function getIsDefault(): ?int
{
return $this->isDefault;
}
public function setIsDefault(?int $isDefault): self
{
$this->isDefault = $isDefault;
return $this;
}
}