src/Entity/Activity.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActivityRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClass:ActivityRepository::class)]
  8. class Activity
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue(strategy:'AUTO')]
  12.     #[ORM\Column(type:'integer'unique:true)]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntity:Person::class, inversedBy:'activities')]
  15.     private $user;
  16.     #[ORM\Column(type:'datetime'nullable:true)]
  17.     private $dateTimeStart;
  18.     #[ORM\Column(type:'datetime'nullable:true)]
  19.     private $dateTimeEnd;
  20.     #[ORM\Column(type:'float'nullable:true)]
  21.     private $latStart;
  22.     #[ORM\Column(type:'float'nullable:true)]
  23.     private $lonStart;
  24.     #[ORM\Column(type:'float'nullable:true)]
  25.     private $latEnd;
  26.     #[ORM\Column(type:'float'nullable:true)]
  27.     private $lonEnd;
  28.     #[ORM\Column(type:'integer'nullable:true)]
  29.     private $steps;
  30.     #[ORM\Column(type:'integer'nullable:true)]
  31.     private $calories;
  32.     #[ORM\Column(type:'string'length:50)]
  33.     private $status;
  34.     #[ORM\Column(type:'datetime')]
  35.     private $createdAt;
  36.     #[ORM\ManyToOne(targetEntity:ActivityType::class)]
  37.     private $activityType;
  38.     #[ORM\Column(type:'float')]
  39.     private $totalC02;
  40.     #[ORM\OneToMany(targetEntity:ActivityTransport::class, mappedBy:'activity')]
  41.     private $activityTransports;
  42.     #[ORM\Column(type:'float'nullable:true)]
  43.     private $totalDistance;
  44.     #[ORM\OneToMany(targetEntity:ActivityPosition::class, mappedBy:'activity'orphanRemoval:true)]
  45.     private $activityPositions;
  46.     public function __construct()
  47.     {
  48.         $this->activityTransports = new ArrayCollection();
  49.         $this->activityPositions = new ArrayCollection();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getUser(): ?int
  56.     {
  57.         return $this->user->getId();
  58.     }
  59.     public function setUser(?Person $user): self
  60.     {
  61.         $this->user $user;
  62.         return $this;
  63.     }
  64.     public function getDateTimeStart(): ?\DateTimeInterface
  65.     {
  66.         return $this->dateTimeStart;
  67.     }
  68.     public function setDateTimeStart(?\DateTimeInterface $dateTimeStart): self
  69.     {
  70.         $this->dateTimeStart $dateTimeStart;
  71.         return $this;
  72.     }
  73.     public function getDateTimeEnd(): ?\DateTimeInterface
  74.     {
  75.         return $this->dateTimeEnd;
  76.     }
  77.     public function setDateTimeEnd(?\DateTimeInterface $dateTimeEnd): self
  78.     {
  79.         $this->dateTimeEnd $dateTimeEnd;
  80.         return $this;
  81.     }
  82.     public function getLatStart(): ?float
  83.     {
  84.         return $this->latStart;
  85.     }
  86.     public function setLatStart(?float $latStart): self
  87.     {
  88.         $this->latStart $latStart;
  89.         return $this;
  90.     }
  91.     public function getLonStart(): ?float
  92.     {
  93.         return $this->lonStart;
  94.     }
  95.     public function setLonStart(?float $lonStart): self
  96.     {
  97.         $this->lonStart $lonStart;
  98.         return $this;
  99.     }
  100.     public function getLatEnd(): ?float
  101.     {
  102.         return $this->latEnd;
  103.     }
  104.     public function setLatEnd(?float $latEnd): self
  105.     {
  106.         $this->latEnd $latEnd;
  107.         return $this;
  108.     }
  109.     public function getLonEnd(): ?float
  110.     {
  111.         return $this->lonEnd;
  112.     }
  113.     public function setLonEnd(?float $lonEnd): self
  114.     {
  115.         $this->lonEnd $lonEnd;
  116.         return $this;
  117.     }
  118.     public function getSteps(): ?int
  119.     {
  120.         return $this->steps;
  121.     }
  122.     public function setSteps(int $steps): self
  123.     {
  124.         $this->steps $steps;
  125.         return $this;
  126.     }
  127.     public function getCalories(): ?int
  128.     {
  129.         return $this->calories;
  130.     }
  131.     public function setCalories(int $calories): self
  132.     {
  133.         $this->calories $calories;
  134.         return $this;
  135.     }
  136.     public function getStatus(): ?string
  137.     {
  138.         return $this->status;
  139.     }
  140.     public function setStatus(string $status): self
  141.     {
  142.         $this->status $status;
  143.         return $this;
  144.     }
  145.     public function getCreatedAt(): ?\DateTimeInterface
  146.     {
  147.         return $this->createdAt;
  148.     }
  149.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  150.     {
  151.         $this->createdAt $createdAt;
  152.         return $this;
  153.     }
  154.     public function getActivityType(): ?int
  155.     {
  156.         return $this->activityType->getId();
  157.     }
  158.     public function setActivityType(?ActivityType $activityType): self
  159.     {
  160.         $this->activityType $activityType;
  161.         return $this;
  162.     }
  163.     public function getTotalC02(): ?float
  164.     {
  165.         return $this->totalC02;
  166.     }
  167.     public function setTotalC02(float $totalC02): self
  168.     {
  169.         $this->totalC02 $totalC02;
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return Collection|ActivityTransport[]
  174.      */
  175.     public function getActivityTransports(): Collection
  176.     {
  177.         return $this->activityTransports;
  178.     }
  179.     public function addActivityTransport(ActivityTransport $activityTransport): self
  180.     {
  181.         if (!$this->activityTransports->contains($activityTransport)) {
  182.             $this->activityTransports[] = $activityTransport;
  183.             $activityTransport->setActivity($this);
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeActivityTransport(ActivityTransport $activityTransport): self
  188.     {
  189.         if ($this->activityTransports->removeElement($activityTransport)) {
  190.             // set the owning side to null (unless already changed)
  191.             if ($activityTransport->getActivity() === $this) {
  192.                 $activityTransport->setActivity(null);
  193.             }
  194.         }
  195.         return $this;
  196.     }
  197.     public function getTotalDistance(): ?float
  198.     {
  199.         return $this->totalDistance;
  200.     }
  201.     public function setTotalDistance(?float $totalDistance): self
  202.     {
  203.         $this->totalDistance $totalDistance;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return Collection|ActivityPosition[]
  208.      */
  209.     public function getActivityPositions(): Collection
  210.     {
  211.         return $this->activityPositions;
  212.     }
  213.     public function addActivityPosition(ActivityPosition $activityPosition): self
  214.     {
  215.         if (!$this->activityPositions->contains($activityPosition)) {
  216.             $this->activityPositions[] = $activityPosition;
  217.             $activityPosition->setActivity($this);
  218.         }
  219.         return $this;
  220.     }
  221.     public function removeActivityPosition(ActivityPosition $activityPosition): self
  222.     {
  223.         if ($this->activityPositions->removeElement($activityPosition)) {
  224.             // set the owning side to null (unless already changed)
  225.             if ($activityPosition->getActivity() === $this) {
  226.                 $activityPosition->setActivity(null);
  227.             }
  228.         }
  229.         return $this;
  230.     }
  231. }