src/Entity/Calculation.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CalculationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass: CalculationRepository::class)]
  6. #[ORM\HasLifecycleCallbacks]
  7. class Calculation
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type: 'integer')]
  12.     private int $id;
  13.     #[ORM\ManyToOne(targetEntity: Period::class, inversedBy: 'calculations')]
  14.     #[ORM\JoinColumn(nullable: false)]
  15.     private Period $Period;
  16.     #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'calculations')]
  17.     #[ORM\JoinColumn(nullable: false)]
  18.     private User $User;
  19.     #[ORM\Column(type: 'integer')]
  20.     private ?int $exams = null;
  21.     #[ORM\Column(type: 'integer')]
  22.     private ?int $points = null;
  23.     #[ORM\Column(type: 'float')]
  24.     private ?float $voucer_value = null;
  25.     #[ORM\Column(type: 'datetime')]
  26.     private ?\DateTimeInterface $createdAt = null;
  27.     #[ORM\Column(type: 'datetime')]
  28.     private ?\DateTimeInterface $updatedAt = null;
  29.     #[ORM\PrePersist]
  30.     #[ORM\PreUpdate]
  31.     public function updatedTimestamps(): void
  32.     {
  33.         $dateTimeNow = new \DateTime('now');
  34.         $this->setUpdatedAt($dateTimeNow);
  35.         if (null === $this->getCreatedAt()) {
  36.             $this->setCreatedAt($dateTimeNow);
  37.         }
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getPeriod(): ?Period
  44.     {
  45.         return $this->Period;
  46.     }
  47.     public function setPeriod(?Period $Period): self
  48.     {
  49.         $this->Period = $Period;
  50.         return $this;
  51.     }
  52.     public function getUser(): ?User
  53.     {
  54.         return $this->User;
  55.     }
  56.     public function setUser(?User $User): self
  57.     {
  58.         $this->User = $User;
  59.         return $this;
  60.     }
  61.     public function getExams(): ?int
  62.     {
  63.         return $this->exams;
  64.     }
  65.     public function setExams(int $exams): self
  66.     {
  67.         $this->exams = $exams;
  68.         return $this;
  69.     }
  70.     public function getPoints(): ?int
  71.     {
  72.         return $this->points;
  73.     }
  74.     public function setPoints(int $points): self
  75.     {
  76.         $this->points = $points;
  77.         return $this;
  78.     }
  79.     public function getVoucerValue(): ?float
  80.     {
  81.         return $this->voucer_value;
  82.     }
  83.     public function setVoucerValue(float $voucer_value): self
  84.     {
  85.         $this->voucer_value = $voucer_value;
  86.         return $this;
  87.     }
  88.     public function getCreatedAt(): ?\DateTimeInterface
  89.     {
  90.         return $this->createdAt;
  91.     }
  92.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  93.     {
  94.         $this->createdAt = $createdAt;
  95.         return $this;
  96.     }
  97.     public function getUpdatedAt(): ?\DateTimeInterface
  98.     {
  99.         return $this->updatedAt;
  100.     }
  101.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  102.     {
  103.         $this->updatedAt = $updatedAt;
  104.         return $this;
  105.     }
  106. }