src\Entity\Tracking.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\TrackingRepository")
  8.  */
  9. class Tracking
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $token;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="trackings")
  23.      */
  24.     private $user;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      */
  28.     private $user_agent;
  29.     /**
  30.      * @ORM\Column(type="datetime")
  31.      */
  32.     private $created_at;
  33.     /**
  34.      * @ORM\Column(type="datetime", nullable=true)
  35.      */
  36.     private $logged_at;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity="App\Entity\TrackingDetail", mappedBy="tracking", orphanRemoval=true)
  39.      */
  40.     private $trackingDetails;
  41.     public function __construct()
  42.     {
  43.         $this->created_at=new \DateTime();
  44.         $this->trackingDetails = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getToken(): ?string
  51.     {
  52.         return $this->token;
  53.     }
  54.     public function setToken(string $token): self
  55.     {
  56.         $this->token $token;
  57.         return $this;
  58.     }
  59.     public function getUser(): ?User
  60.     {
  61.         return $this->user;
  62.     }
  63.     public function setUser(?User $user): self
  64.     {
  65.         $this->user $user;
  66.         return $this;
  67.     }
  68.     public function getUserAgent(): ?string
  69.     {
  70.         return $this->user_agent;
  71.     }
  72.     public function setUserAgent(string $user_agent): self
  73.     {
  74.         $this->user_agent $user_agent;
  75.         return $this;
  76.     }
  77.     public function getCreatedAt(): ?\DateTimeInterface
  78.     {
  79.         return $this->created_at;
  80.     }
  81.     public function setCreatedAt(\DateTimeInterface $created_at): self
  82.     {
  83.         $this->created_at $created_at;
  84.         return $this;
  85.     }
  86.     public function getLoggedAt(): ?\DateTimeInterface
  87.     {
  88.         return $this->logged_at;
  89.     }
  90.     public function setLoggedAt(?\DateTimeInterface $logged_at): self
  91.     {
  92.         $this->logged_at $logged_at;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection|TrackingDetail[]
  97.      */
  98.     public function getTrackingDetails(): Collection
  99.     {
  100.         return $this->trackingDetails;
  101.     }
  102.     public function addTrackingDetail(TrackingDetail $trackingDetail): self
  103.     {
  104.         if (!$this->trackingDetails->contains($trackingDetail)) {
  105.             $this->trackingDetails[] = $trackingDetail;
  106.             $trackingDetail->setTracking($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeTrackingDetail(TrackingDetail $trackingDetail): self
  111.     {
  112.         if ($this->trackingDetails->contains($trackingDetail)) {
  113.             $this->trackingDetails->removeElement($trackingDetail);
  114.             // set the owning side to null (unless already changed)
  115.             if ($trackingDetail->getTracking() === $this) {
  116.                 $trackingDetail->setTracking(null);
  117.             }
  118.         }
  119.         return $this;
  120.     }
  121.    
  122. }