<?php
namespace App\Entity;
use App\Repository\ImeiRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ImeiRepository::class)
*/
class Imei
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=32)
*/
private $imei;
/**
* @ORM\OneToOne(targetEntity=Order::class, inversedBy="imeis", cascade={"persist", "remove"})
*/
private $order;
/**
* @ORM\ManyToOne(targetEntity=Product::class)
*/
private $product;
/**
* @ORM\ManyToOne(targetEntity=Shop::class, inversedBy="imeis")
* @ORM\JoinColumn(nullable=false)
*/
private $shop;
/**
* @ORM\Column(type="string", length=128)
*/
private $tracking;
/**
* @ORM\ManyToOne(targetEntity=Cart::class, inversedBy="imei")
*/
private $cart;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $sync;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $date;
/**
* @ORM\ManyToMany(targetEntity=Sav::class, inversedBy="imeis")
*/
private $savs;
public function __construct()
{
$this->savs = new ArrayCollection();
}
public function __toString() {
return $this->getImei()." (".$this->getProduct().")";
}
public function getId(): ?int
{
return $this->id;
}
public function getImei(): ?string
{
return $this->imei;
}
public function setImei(string $imei): self
{
$this->imei = $imei;
return $this;
}
public function getOrder(): ?Order
{
return $this->order;
}
public function setOrder(?Order $order): self
{
$this->order = $order;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getShop(): ?Shop
{
return $this->shop;
}
public function setShop(?Shop $shop): self
{
$this->shop = $shop;
return $this;
}
public function getTracking(): ?string
{
return $this->tracking;
}
public function setTracking(string $tracking): self
{
$this->tracking = $tracking;
return $this;
}
public function getCart(): ?Cart
{
return $this->cart;
}
public function setCart(?Cart $cart): self
{
$this->cart = $cart;
return $this;
}
public function getSync(): ?bool
{
return $this->sync;
}
public function setSync(?bool $sync): self
{
$this->sync = $sync;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function isSync(): ?bool
{
return $this->sync;
}
/**
* @return Collection<int, Sav>
*/
public function getSavs(): Collection
{
return $this->savs;
}
public function addSav(Sav $sav): static
{
if (!$this->savs->contains($sav)) {
$this->savs->add($sav);
}
return $this;
}
public function removeSav(Sav $sav): static
{
$this->savs->removeElement($sav);
return $this;
}
}