src/Entity/UserTrackingDuration.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserTrackingDurationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=UserTrackingDurationRepository::class)
  7.  */
  8. class UserTrackingDuration
  9. {
  10.     /**
  11.      * @ORM\Id()
  12.      * @ORM\GeneratedValue()
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\OneToOne(targetEntity=User::class, mappedBy="userTrackingDuration", cascade={"persist", "remove"})
  18.      */
  19.     private $user;
  20.     /**
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $averageDuration;
  24.     /**
  25.      * @ORM\Column(type="datetime")
  26.      */
  27.     private $updatedAt;
  28.     /**
  29.      * @ORM\Column(type="string", length=40, nullable=true)
  30.      */
  31.     private $userRole;
  32.     public function getId(): ?int
  33.     {
  34.         return $this->id;
  35.     }
  36.     public function getUser(): ?User
  37.     {
  38.         return $this->user;
  39.     }
  40.     public function setUser(?User $user): self
  41.     {
  42.         $this->user $user;
  43.         // set (or unset) the owning side of the relation if necessary
  44.         $newUserTrackingDuration null === $user null $this;
  45.         if ($user->getUserTrackingDuration() !== $newUserTrackingDuration) {
  46.             $user->setUserTrackingDuration($newUserTrackingDuration);
  47.         }
  48.         return $this;
  49.     }
  50.     /**
  51.      * @return int|null : number of seconds
  52.      */
  53.     public function getAverageDuration(): ?int
  54.     {
  55.         return $this->averageDuration;
  56.     }
  57.     /**
  58.      * @param int $averageDuration : number of seconds
  59.      * @return $this
  60.      */
  61.     public function setAverageDuration(int $averageDuration): self
  62.     {
  63.         $this->averageDuration $averageDuration;
  64.         return $this;
  65.     }
  66.     public function getUpdatedAt(): ?\DateTimeInterface
  67.     {
  68.         return $this->updatedAt;
  69.     }
  70.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  71.     {
  72.         $this->updatedAt $updatedAt;
  73.         return $this;
  74.     }
  75.     public function getUserRole(): ?string
  76.     {
  77.         return $this->userRole;
  78.     }
  79.     public function setUserRole(?string $userRole): self
  80.     {
  81.         $this->userRole $userRole;
  82.         return $this;
  83.     }
  84. }