src\Entity\Tracking.php line 10

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. #[ORM\Entity(repositoryClass\App\Repository\TrackingRepository::class)]
  7. class Tracking
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'string'length255)]
  14.     private $token;
  15.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'trackings')]
  16.     private $user;
  17.     #[ORM\Column(type'string'length255)]
  18.     private $user_agent;
  19.     #[ORM\Column(type'datetime')]
  20.     private $created_at;
  21.     #[ORM\Column(type'datetime'nullabletrue)]
  22.     private $logged_at;
  23.     #[ORM\OneToMany(targetEntityTrackingDetail::class, mappedBy'tracking'orphanRemovaltrue)]
  24.     private $trackingDetails;
  25.     public function __construct()
  26.     {
  27.         $this->created_at=new \DateTime();
  28.         $this->trackingDetails = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getToken(): ?string
  35.     {
  36.         return $this->token;
  37.     }
  38.     public function setToken(string $token): self
  39.     {
  40.         $this->token $token;
  41.         return $this;
  42.     }
  43.     public function getUser(): ?User
  44.     {
  45.         return $this->user;
  46.     }
  47.     public function setUser(?User $user): self
  48.     {
  49.         $this->user $user;
  50.         return $this;
  51.     }
  52.     public function getUserAgent(): ?string
  53.     {
  54.         return $this->user_agent;
  55.     }
  56.     public function setUserAgent(string $user_agent): self
  57.     {
  58.         $this->user_agent $user_agent;
  59.         return $this;
  60.     }
  61.     public function getCreatedAt(): ?\DateTimeInterface
  62.     {
  63.         return $this->created_at;
  64.     }
  65.     public function setCreatedAt(\DateTimeInterface $created_at): self
  66.     {
  67.         $this->created_at $created_at;
  68.         return $this;
  69.     }
  70.     public function getLoggedAt(): ?\DateTimeInterface
  71.     {
  72.         return $this->logged_at;
  73.     }
  74.     public function setLoggedAt(?\DateTimeInterface $logged_at): self
  75.     {
  76.         $this->logged_at $logged_at;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection|TrackingDetail[]
  81.      */
  82.     public function getTrackingDetails(): Collection
  83.     {
  84.         return $this->trackingDetails;
  85.     }
  86.     public function addTrackingDetail(TrackingDetail $trackingDetail): self
  87.     {
  88.         if (!$this->trackingDetails->contains($trackingDetail)) {
  89.             $this->trackingDetails[] = $trackingDetail;
  90.             $trackingDetail->setTracking($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeTrackingDetail(TrackingDetail $trackingDetail): self
  95.     {
  96.         if ($this->trackingDetails->contains($trackingDetail)) {
  97.             $this->trackingDetails->removeElement($trackingDetail);
  98.             // set the owning side to null (unless already changed)
  99.             if ($trackingDetail->getTracking() === $this) {
  100.                 $trackingDetail->setTracking(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.    
  106. }