src/Entity/Imei.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ImeiRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ImeiRepository::class)
  10.  */
  11. class Imei
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=32)
  21.      */
  22.     private $imei;
  23.     /**
  24.      * @ORM\OneToOne(targetEntity=Order::class, inversedBy="imeis", cascade={"persist", "remove"})
  25.      */
  26.     private $order;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Product::class)
  29.      */
  30.     private $product;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=Shop::class, inversedBy="imeis")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $shop;
  36.     /**
  37.      * @ORM\Column(type="string", length=128)
  38.      */
  39.     private $tracking;
  40.     /**
  41.      * @ORM\ManyToOne(targetEntity=Cart::class, inversedBy="imei")
  42.      */
  43.     private $cart;
  44.     /**
  45.      * @ORM\Column(type="boolean", nullable=true)
  46.      */
  47.     private $sync;
  48.     /**
  49.      * @ORM\Column(type="datetime", nullable=true)
  50.      */
  51.     private $date;
  52.     /**
  53.      * @ORM\ManyToMany(targetEntity=Sav::class, inversedBy="imeis")
  54.      */
  55.     private $savs;
  56.     public function __construct()
  57.     {
  58.         $this->savs = new ArrayCollection();
  59.     }
  60.     public function __toString() {
  61.         return $this->getImei()." (".$this->getProduct().")";
  62.     }
  63.     public function getId(): ?int
  64.     {
  65.         return $this->id;
  66.     }
  67.     public function getImei(): ?string
  68.     {
  69.         return $this->imei;
  70.     }
  71.     public function setImei(string $imei): self
  72.     {
  73.         $this->imei $imei;
  74.         return $this;
  75.     }
  76.     public function getOrder(): ?Order
  77.     {
  78.         return $this->order;
  79.     }
  80.     public function setOrder(?Order $order): self
  81.     {
  82.         $this->order $order;
  83.         return $this;
  84.     }
  85.     public function getProduct(): ?Product
  86.     {
  87.         return $this->product;
  88.     }
  89.     public function setProduct(?Product $product): self
  90.     {
  91.         $this->product $product;
  92.         return $this;
  93.     }
  94.     public function getShop(): ?Shop
  95.     {
  96.         return $this->shop;
  97.     }
  98.     public function setShop(?Shop $shop): self
  99.     {
  100.         $this->shop $shop;
  101.         return $this;
  102.     }
  103.     public function getTracking(): ?string
  104.     {
  105.         return $this->tracking;
  106.     }
  107.     public function setTracking(string $tracking): self
  108.     {
  109.         $this->tracking $tracking;
  110.         return $this;
  111.     }
  112.     public function getCart(): ?Cart
  113.     {
  114.         return $this->cart;
  115.     }
  116.     public function setCart(?Cart $cart): self
  117.     {
  118.         $this->cart $cart;
  119.         return $this;
  120.     }
  121.     public function getSync(): ?bool
  122.     {
  123.         return $this->sync;
  124.     }
  125.     public function setSync(?bool $sync): self
  126.     {
  127.         $this->sync $sync;
  128.         return $this;
  129.     }
  130.     public function getDate(): ?\DateTimeInterface
  131.     {
  132.         return $this->date;
  133.     }
  134.     public function setDate(\DateTimeInterface $date): self
  135.     {
  136.         $this->date $date;
  137.         return $this;
  138.     }
  139.     public function isSync(): ?bool
  140.     {
  141.         return $this->sync;
  142.     }
  143.     /**
  144.      * @return Collection<int, Sav>
  145.      */
  146.     public function getSavs(): Collection
  147.     {
  148.         return $this->savs;
  149.     }
  150.     public function addSav(Sav $sav): static
  151.     {
  152.         if (!$this->savs->contains($sav)) {
  153.             $this->savs->add($sav);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeSav(Sav $sav): static
  158.     {
  159.         $this->savs->removeElement($sav);
  160.         return $this;
  161.     }
  162. }